Difference between revisions of "Oolite JavaScript Reference: Mission"

From Elite Wiki
Line 1: Line 1:
 
== Properties ==
 
== Properties ==
  
  '''missionScreenTextKey''' : String (write-only)
+
  '''choice''' : String (read/write)
  
Sets the dictionary key for the mission screen text. Use the same value you’d give <code>addMissionText:</code>. '''Important:''' will be deprecated in Oolite 1.70, replacement mechanism to be determined.
+
The most recently selected choice from the mission screen. The empty string <code>"None"</code> is used for no choice. '''Important:''' in future versions, <code>null</code> will be used to indicate no choice. A choice can be cleared by setting mission.choice = null. This clearing will trigger the missionChoiceWasReset handler.
  
  
'''musicFileName''' : String (write-only)
+
== Methods ==
  
Sets the file name for the mission music. Only has an effect on Mac OS X at present. '''Important:''' will be deprecated in favour of new <code>setMusic()</code> function in Oolite 1.70.
+
function '''addMessageTextKey'''(messageKey : String)
  
 +
Sets the dictionary key for the mission screen text. Use the same value you’d give <code>addMissionText:</code>. Must be called '''''after''''' <code>showMissionScreen</code>.
  
  '''imageFileName''' : String (write-only)
+
  function '''setBackgroundImage'''(backgroundImage : String)
  
Sets the filename for an image to be displayed on the mission screen. '''Important:''' will be deprecated in favour of new <code>setBackgroundImage()</code> function in Oolite 1.70.
+
Specifies a background image to be shown at the mission screen. Must be called '''''before''''' <code>showMissionScreen</code>.
  
 +
function '''setChoicesKey'''(choicesKey : String)
  
'''choicesKey''' : String (write-only)
+
Specifies the choices to be shown at the mission screen. Must be called '''''after''''' <code>showMissionScreen</code>.
  
Sets the dictionary key of the choices on the mission screen. '''Important:''' will be deprecated in favour of new <code>setChoicesKey()</code> function in Oolite 1.70.
+
function '''setInstructionsKey(descriptionKey : String, [worldScript : String])'''
  
 +
Sets the dictionary key of the text to put on the manifest screen (usually short instructions for current missions. F5-F5). When not called from within the worldScript, the script name has to be specified additionally.
  
  '''choice''' : String (read-only)
+
  function '''setMusic'''(musicKey : String)
  
The most recently selected choice from the mission screen. The empty string <code>"None"</code> is used for no choice. '''Important:''' in future versions, <code>null</code> will be used to indicate no choice.
+
Specifies a music file to be played at the mission screen. Must be called '''''before''''' <code>showMissionScreen</code>.
 
 
 
 
'''function setInstructionsKey(descriptionKey: string, [worldScript: string])'''
 
 
 
Sets the dictionary key of the text to put on the manifest screen (usually short instructions for current missions). When not called from within a worldScript, the script has to be specified.
 
 
 
== Methods ==
 
  
 
  function '''showMissionScreen'''()
 
  function '''showMissionScreen'''()
  
Shows the mission screen. Due to implementation details <code>musicFileName</code>, <code>imageFileName</code> and <code>showShipModel()</code> must be set '''''before''''' this method is called, but <code>missionScreenTextKey</code> and <code>choicesKey</code> must be set '''''after''''' this method is called.
+
Shows the mission screen. Due to implementation details <code>musicKey</code>, <code>backgroundImage</code> and <code>shipKey</code> must be set '''''before''''' this method is called, but <code>messageKey</code> and <code>choicesKey</code> must be set '''''after''''' this method is called.
 
 
  
 
  function '''showShipModel'''(shipKey : String)
 
  function '''showShipModel'''(shipKey : String)
Line 41: Line 36:
 
Specifies a ship model to be displayed on the mission screen. Must be called '''''before''''' <code>showMissionScreen</code>. (Open issue: why is this a method rather than a write-only property? --[[User:Ahruman|ahruman]])
 
Specifies a ship model to be displayed on the mission screen. Must be called '''''before''''' <code>showMissionScreen</code>. (Open issue: why is this a method rather than a write-only property? --[[User:Ahruman|ahruman]])
  
 +
function '''runMissionScreen'''(messageKey : String, backgroundImage : String, choiceKey : String, shipKey : String, musicKey : String)
  
function '''resetMissionChoice'''()
+
This is the recommended way to set up a missionscreen. It does all the setup or clearing of the Key's. Strictly spoken it is not a method but a JS routine that calls the appropriate methods in the right order. After setting up and showing the missionscreen it clears the keys.
 
 
After calling this method, the <code>mission.choice</code> property will return <code>"None"</code>. (Open issue: why not just make <code>choice</code> read/write? --[[User:Ahruman|ahruman]])
 
 
 
  
 
  function '''markSystem'''(systemNumbers : Number, ...)
 
  function '''markSystem'''(systemNumbers : Number, ...)

Revision as of 21:33, 24 June 2008

Properties

choice : String (read/write)

The most recently selected choice from the mission screen. The empty string "None" is used for no choice. Important: in future versions, null will be used to indicate no choice. A choice can be cleared by setting mission.choice = null. This clearing will trigger the missionChoiceWasReset handler.


Methods

function addMessageTextKey(messageKey : String)

Sets the dictionary key for the mission screen text. Use the same value you’d give addMissionText:. Must be called after showMissionScreen.

function setBackgroundImage(backgroundImage : String)

Specifies a background image to be shown at the mission screen. Must be called before showMissionScreen.

function setChoicesKey(choicesKey : String)

Specifies the choices to be shown at the mission screen. Must be called after showMissionScreen.

function setInstructionsKey(descriptionKey : String, [worldScript : String])

Sets the dictionary key of the text to put on the manifest screen (usually short instructions for current missions. F5-F5). When not called from within the worldScript, the script name has to be specified additionally.

function setMusic(musicKey : String)

Specifies a music file to be played at the mission screen. Must be called before showMissionScreen.

function showMissionScreen()

Shows the mission screen. Due to implementation details musicKey, backgroundImage and shipKey must be set before this method is called, but messageKey and choicesKey must be set after this method is called.

function showShipModel(shipKey : String)

Specifies a ship model to be displayed on the mission screen. Must be called before showMissionScreen. (Open issue: why is this a method rather than a write-only property? --ahruman)

function runMissionScreen(messageKey : String, backgroundImage : String, choiceKey : String, shipKey : String, musicKey : String)

This is the recommended way to set up a missionscreen. It does all the setup or clearing of the Key's. Strictly spoken it is not a method but a JS routine that calls the appropriate methods in the right order. After setting up and showing the missionscreen it clears the keys.

function markSystem(systemNumbers : Number, ...)

Mark the listed systems on the long range chart; for example, mission.markSystem(4, 54, 222) will mark system numbers 4, 54, and 222. Note: eventually this will be deprecated for syntax along the lines of currentGalaxy.systems[4].marked = false;, but this form should continue to work.


function unmarkSystem(systemNumbers : Number, ...)

Remove the marks from the listed systems on the long range chart; for example, mission.unmarkSystem(4 54) will unmark system numbers 4, and 54.