Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Updated OSE NPC timer scripts

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

pmw57
---- E L I T E ----
---- E L I T E ----
Posts: 389
Joined: Sat Sep 26, 2009 2:14 pm
Location: Christchurch, New Zealand

Post by pmw57 »

Kaks wrote:
20:30, 25 August 2009 (hist) (diff) Oolite JavaScript Reference: Timer
20:13, 25 August 2009 (hist) (diff) Oolite JavaScript Reference: Timer

Are both on that list, and seem to refer to timers. It might be what Eric is referring to.
Ahh, further back than a month and below the fold back into August, excellent. Will have it then.
A trumble a day keeps the doctor away, and the tax man;
even the Grim Reaper keeps his distance.
-- Paul Wilkins
pmw57
---- E L I T E ----
---- E L I T E ----
Posts: 389
Joined: Sat Sep 26, 2009 2:14 pm
Location: Christchurch, New Zealand

Post by pmw57 »

The OSE NPC timer scripts have been made, and are ready to be downloaded and tested.
ose npc timer scripts.7z
A trumble a day keeps the doctor away, and the tax man;
even the Grim Reaper keeps his distance.
-- Paul Wilkins
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

pmw57 wrote:
Ahh, further back than a month and below the fold back into August, excellent. Will have it then.
Probably the current workaround is also okay, as the main reason for crashes is that a timer tries to change properties of a removed script and that is also handled in your case.
But when testing if the ship itself is still present and valid shows better why the test is executed.

I remember from testing a year ago that even when the ship was removed, this.ship was sometimes true as an object with as only property the isValid property. Therefor the double check.
scrip is a property of this.ship. this.cloakedTarget is a property of the script. You and Kaks are much more experienced with JS than I am but if script does not exist I don't know what if (this.cloakedTarget && !this.cloakedTarget.isCloaked) does.

I know that this.cloakedTarget is identical to this ship.script.cloakedTarget. You can access ship.script properties from outside scripts by examining the script property of a ship.
Post Reply