Oolite JavaScript Reference: object model

From EliteWiki

Jump to: navigation, search

Note: this documentation is incomplete and somewhat out of date. It will be replaced soon.

Contents

[edit] Global Properties

Global properties can be used just by giving their name - no qualifying information is required. Note: some of these will probably be moved into player.


galaxyNumber : Number (read-only, integer)

The current galaxy number, 0 - 7; for example, if (galaxyNumber == 0).


planetNumber : Number (read-only, integer)

The current planet/star number within the current galaxy, 0 - 255; for example, if (planetNumber == 42).


missionVariables : Object (read/write)

This is how the script can get and set mission variables whose values are made persistent in the save game file. To get the value of a mission variable use syntax like missionVariables["mymission_status"], where “mymission_status” is the mission variable name. To set the value of a mission variable just assign a new value like missionVariables["mymission_status"] = "MYMISSION_STARTED". Note that unlike plist scripts, no “mission_” prefix is required; “mymission_status” in JavaScript is equivalent to “mission_mymission_status” in a plist.


guiScreen : String (read-only)

Indicates which GUI screen is being displayed.


[edit] Global Methods

Like global properties, global methods can be invoked by name with no qualifiers.


Log(message : String)

Logs a message to the game's logging stream, using the message class “script.debug.message”.


LogWithClass(class : String, message : String)

Logs a message to the game's logging stream, using the specified message class.


[edit] Global Objects

Global objects are always available and their properties and methods can be referenced by object.property and object.method(), where object is the global object’s name and property or method is the name of the property or method.

[edit] player

The player object represents the player’s commander and ship – the two are inseparable. See Oolite JavaScript Reference: Player.

[edit] system

The system object represents the current solar system. See Oolite JavaScript Reference: System.


[edit] mission

The mission object allows interaction with the mission screen. Note: this will eventually be replaced by a more modular system, where multiple objects of class Mission can be created and the game is responsible for handling conflicts. See Oolite JavaScript Reference: Mission.

Personal tools