renaming the built-in mission scripts
Posted: Fri Nov 14, 2008 4:39 pm
I discovered that JS has a problem with recognizing the hyphen (-) in script names. It just doesn't.
As a result of this it is not possible to interact with any world scripts that contain a hyphen in their name, for instance if you want to check for their existence with
or something else. However
or
works fine.
This concerns all scripts which have a hyphen in their name property, the most outstanding examples of which are the built-in missions (oolite-cloaking-device, oolite-constrictor-hunt, oolite-nova, oolite-thargoid-plans and oolite-trumbles). So I suggest to rename them, in order not to set a bad example for OXPers, who might just copy what they find in the game.
As a result of this it is not possible to interact with any world scripts that contain a hyphen in their name, for instance if you want to check for their existence with
Code: Select all
if(worldScripts.that-particular-script)
{
do stuff
}
Code: Select all
if(worldScripts.that_particular_script)
{
do stuff
}
Code: Select all
if(worldScripts.thatParticularScript)
{
do stuff
}
This concerns all scripts which have a hyphen in their name property, the most outstanding examples of which are the built-in missions (oolite-cloaking-device, oolite-constrictor-hunt, oolite-nova, oolite-thargoid-plans and oolite-trumbles). So I suggest to rename them, in order not to set a bad example for OXPers, who might just copy what they find in the game.