Page 7 of 7

Re: Target Autolock OXP

Posted: Sat Feb 12, 2022 9:37 pm
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

Re: Target Autolock OXP

Posted: Sun Feb 13, 2022 4:42 am
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.

Re: Target Autolock OXP

Posted: Sun Feb 13, 2022 1:21 pm
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.

Re: Target Autolock OXP

Posted: Sun Feb 13, 2022 5:33 pm
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.

Re: Target Autolock OXP

Posted: Sun Feb 13, 2022 5:49 pm
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!

Re: Target Autolock OXP

Posted: Sun Feb 13, 2022 10:16 pm
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.

Re: Target Autolock OXP

Posted: Mon Feb 14, 2022 11:40 am
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.

Re: Target Autolock OXP

Posted: Mon Feb 14, 2022 11:56 am
by Cody
I'm still using TAP 1.12 (which is still available here).