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

OXPs that throw errors because player.ship variables are not available

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

Moderators: another_commander, winston

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

OXPs that throw errors because player.ship variables are not available

Post by UK_Eliter »

I've been looking at my logs - in the service of debugging my own OXPs - and I find that several OXPs make assumptions about player.ship that sometimes are false. To wit: that player.ship.position, or various other attributes, are set. If one is in an escape pod, or docked (though perhaps some OXPs check for being docked with the main station) then - and perhaps under other conditions - these assumptions are false. Thus such errors as the following - though I think that more OXPs than the two that I list below (namely, CustomShields and interstellar_help) are affected.

Code: Select all

[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (customshields 0.83): TypeError: player.ship.position is undefined
23:06:35.404 [script.javaScript.exception.unexpectedType]:       C:\Oolite/oolite.app/GNUstep/Library/ApplicationSupport/Oolite/ManagedAddOns/oolite.oxp.CommonSenseOTB.CustomShields.oxz/Scripts/customshields.js, line 88.

Code: Select all

23:06:39.074 [script.javaScript.exception.ooliteDefined]: ***** JavaScript exception (interstellar-help-ship 2.1): Error: Vector3D.distanceTo: Could not construct vector from parameters (undefined) -- expected Vector, Entity or array of three numbers.
23:06:39.074 [script.javaScript.exception.ooliteDefined]:       ../AddOns/interstellar_help.oxp/Scripts/interstellar-help-ship.js, line 81.
Post Reply