docwild wrote:The missionVariables... Are they stings or numbers only?
Mission variables are always strings internally. A mission variable with a numerical value is always converted to a number when retrieving it through JavaScript. If a non-string value (including a number) is assigned to a mission variable, it is converted to a string by the standard language mechanism, which generally corresponds to calling
toString(). This behaviour is required for compatibility with the legacy scripting mechanism, where all variables are strings (but basic arithmetic is supported).
There is no useful way to store a reference to a ship in a mission variable. Non-player ships are not persisted across sessions (except, in a limited way, ships in scanned wormholes), and mission variables are only useful for persistence.
For other types, you’d need to serialize manually. There’s currently no JSON implementation in Oolite, but
E4X is supported. (To store an XML object, use
missionVariables.foo = myXML.toXMLString(); to restore it, use
myXML = new XML(missionVariables.foo).)
A more general mechanism will probably be added after the next stable release.