Target Autolock OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1248
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Target Autolock OXP

Post by UK_Eliter »

Hi all. This is just to say that, for TargetAutolock Plus, version 1.14, I am seeing a lot of the following in the log, sometimes:

Code: Select all

21:17:06.834 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (targetAutolock 1.14): TypeError: ptarget.scannerDisplayColor1 is null
21:17:07.084 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (targetAutolock 1.14): TypeError: ptarget.scannerDisplayColor1 is null
21:17:07.335 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (targetAutolock 1.14): TypeError: ptarget.scannerDisplayColor1 is null
21:17:07.585 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (targetAutolock 1.14): TypeError: ptarget.scannerDisplayColor1 is null
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Target Autolock OXP

Post by Nite Owl »

Around line 143 in the script.js in the Config folder of v1.14 of this OXZ you will find the following.

Code: Select all

    if (this.$oldTarget && ptarget == this.$oldTarget && 
        ptarget.scannerDisplayColor1.toString() == this.$scanColor1.toString() && 
        ptarget.scannerDisplayColor2.toString() == this.$scanColor2.toString())
        return;
This is the source of the errors you are receiving. Commented out all of it in my copy a while back and the errors stopped. (Must have errors free Mr. Latest Log) Unfortunately dybal was the last one to work on this OXZ which was released right around the time he left the community. Never had the chance to ask him what the above code does or why it was producing these errors. Commenting it out has not has any effect on the the way the OXZ works so you should be good to go with that as a solution. If anyone does have a clue as to what this code does or is attempting to do please feel free to let me know.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1248
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Target Autolock OXP

Post by UK_Eliter »

Nite Owl: thanks. Two things. (1) Commenting-out seems drastic. Why not instead insert a null check? (2) Can anyone make the change to the OXP itself (as against merely to her/his own instance of it)?

EDIT: Re 1, here is what I mean:

Code: Select all

    /*  EDITS by UK_Eliter: I have commented out the next (extended) line, and replaced it with the (extended line) that follows.
        The new version of that line checks for the existence of the attributes that it is trying to set.
    */

    // if (this.$oldTarget && ptarget == this.$oldTarget && 
    //     ptarget.scannerDisplayColor1.toString() == this.$scanColor1.toString() && 
    //     ptarget.scannerDisplayColor2.toString() == this.$scanColor2.toString())
    //     return;
    if (this.$oldTarget && ptarget == this.$oldTarget && 
        ptarget.scannerDisplayColor1 && ptarget.scannerDisplayColor2 &&
        ptarget.scannerDisplayColor1.toString() == this.$scanColor1.toString() && 
        ptarget.scannerDisplayColor2.toString() == this.$scanColor2.toString())
        return;
I have made that change, within the OXP, here (box.net) - but I have not tested it yet.

Perhaps though what commends the commenting out is that it is a simple change and no-one who is around has the authority to alter the OXP itself - yes?

EDIT: my linter complained of missing semi-colons after the closing brace of functions. I think though that here we do not have something that will cause Oolite a problem.
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Target Autolock OXP

Post by Nite Owl »

The original OXZ was one of Thargoid's works. He gave them all up to anyone who cared to take them on when he got too busy to maintain them. dybal took this one on as mentioned previously. My guess would be that as long as Thargoid does not object, doubtful that he would, then anyone could take over the maintenance of this OXZ and add a new version of it to the Wiki and the Expansion Manager. Just a humble error finder here, no coding maintenance for me just yet, so take it away whomever has the desire and the time. It would be much appreciated.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Target Autolock OXP

Post by Cholmondely »

UK_Eliter wrote: Sun Feb 13, 2022 1:21 pm
my linter complained of missing semi-colons after the closing brace of functions. I think though that here we do not have something that will cause Oolite a problem.
Ever tried Oolite on an AppleMac? Semi-colons are the kiss of death...

You Essex chaps have too easy a life!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1248
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Target Autolock OXP

Post by UK_Eliter »

@Cholmondely:

Hah! I seem to recall something about that (semi-colons on a mac being a problem with Oolite; I use Oolite on Windows). Yet, does the problem occur even with Javascript files? The Javascript files in my own OXPs - the OXPs that I wrote - have all the semi-colons that my Linter (JsHint in SublimeText) desires, and I do not think that it causes problems.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Target Autolock OXP

Post by montana05 »

Currently, the only one who could update this package on the manager is phkb. Since dybal had the habit to publish his WIP's it might not be a bad idea to check the entire code, probably some more tweaks would be in order.
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Target Autolock OXP

Post by Cody »

I'm still using TAP 1.12 (which is still available here).
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Post Reply