Legacy Scripting

From Elite Wiki
Revision as of 09:19, 29 September 2022 by Cholmondely (talk | contribs) (Added Ahruman's note on String Variables (not that I understand any of it!))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
XML (left) & OpenStep (right)

Older OXPs (from Aegidian's day) were written entirely in Legacy Script. So if you look, for example, at the innards of Charlie's Benulobiweed oxp's from 2006-7 you will find that everything is written in the legacy scripts. When Aegidian started writing Oolite it was purely for the AppleMac, hence the ability to overwrite portions of the vanilla game code in OpenStep (the Windows and Linux ports were written later by David Taylor & Dylan Smith). XML was also included as a valid OXP language.

Nowadays Legacy scripting is still used in Property list or .plist files.

Legacy script thus comes in two versions: XML & OpenStep.

  • See Methods for more technical information on legacy scripting
  • Converters: Commander Jettison wrote 2 small programmes for translating the more opaque XML into OpenStep which you can find here (2011-17). The older version is on the first page, the newer on the third page of the thread.
  • Commodities: The commodities coding in the older OXPs is particularly obscure. See Commodity Calculator for a helpful download for interpreting it.
  • String Variables: Legacy scripting mechanism only supports string variables (although they can do arithmetic on strings containing numerical values). For JavaScript, mission variables with a purely numeric values are converted to numbers when retrieved, and setting a mission variable to a number converts it to a string behind the scenes; in other words, mission variables can be numbers or strings in the JavaScript programming interface but are always strings internally and in saved games. JensAyton (2010).


Ahruman (2006-13) started introducing Javascript for OXPs when he took over from Aegidian as Lead Designer. But it took 4 years to create a stable new game with Javascript, shaders and his other modernizations. Cim (2013-15) then started changing some of the coding - for example for commodities & AI's.

Modern OXPs are written in JavaScript. Specifically oolite.jsVersion 185, an Oolite specific variant of ECMAv5. It is the same Spidermonkey version (1.8.5 - March 2011) that Firefox 4 shipped with many years ago, but it is a special build for Oolite. This is the version that we have almost always had and it has not changed between versions of the game since Ahruman's day. It is unlikely to change in the future (due to the immense amount of work involved in tampering with it!).

  • See OXP howto for an introduction to current scripting with Javascript

Updating old OXPs

Rather than delve into the intricacies of legacy scripting, it might be easier to write an over-ride OXP in javascript. See Sothis & SothisTC for an example. KillerWolf wrote Sothis in a mix of XML legacy script & javascript in 2010. Spara wrote a javascript override (improving the markets) which is currently (May 2021) being updated (reintroducing dockability etc, which were all lost as Oolite changed).


If you need more information, you can navigate to a relevant page and then inspect the original 2006 version (if there was one) by clicking on the history tab at the top of the page and comparing the early version with the current one. Ahruman started introducing Javascript after he took over from Aegidian which was in early/mid 2007. Since then, the relevant pages have been edited, replacing the legacy script with the newer Javascript. History restores the originals. Note that in a few cases (eg: Commodities.plist) the original legacy script no longer works.