Difference between revisions of "Script.plist"
(→Conditions: correction to ''oneof'' comparison) |
(rejigged filled out stub) |
||
Line 1: | Line 1: | ||
− | '''script.plist''' Used by [[missions]] and [[OXP]]'s to check [[conditions]] and |
+ | '''script.plist''' Used by [[missions]] and [[OXP]]'s to check [[conditions]] and perform scripted actions accordingly. |
− | == Conditions == |
||
+ | In OXP's it can provide Oolite with additional information to generate and populate customised systems. |
||
− | Check whether the current status of one of a number of [[Methods#Querying_states|queriable states]] and [[mission_variable]]s are '''equal''', '''lessthan''', '''greaterthan''' a given value or state, or '''oneof''' a list of comma separated states. |
||
+ | |||
+ | == Structure == |
||
+ | |||
+ | ''script.plist'''s structure is a dictionary, each entry is a particular script with a unique key. |
||
+ | |||
+ | Each script is an array of actions and conditional statements that are executed or checked at regular intervals (every 10 seconds or so during flight). |
||
+ | |||
+ | == Actions == |
||
+ | |||
+ | An action is a simple string referring to a [[methods|method]] |
||
+ | |||
+ | == Conditional statements == |
||
+ | |||
+ | Conditional statements consist of a dictionary with entries for the keys '''conditions''' and '''do''' (and optionally '''else'''.) |
||
+ | |||
+ | === conditions === |
||
+ | |||
+ | '''conditions''' consists of an array of tests to be performed. Each test checks whether the current status of one of a number of [[Methods#Querying_states|queriable states]] and [[mission_variable]]s are '''equal''', '''lessthan''', '''greaterthan''' a given value or state, or '''oneof''' a list of comma separated states. |
||
Multiple conditions may be specified, a logical 'AND' is applied to determine whether the conditions are met or not. |
Multiple conditions may be specified, a logical 'AND' is applied to determine whether the conditions are met or not. |
||
+ | |||
+ | If all the conditions are met then the '''do''' entry is executed, if any are not met then the '''else'' entry is executed (if it exists). |
||
example: |
example: |
||
Line 14: | Line 33: | ||
</dict> |
</dict> |
||
− | == |
+ | === do === |
− | + | ||
+ | '''do''' consists of an array of actions (and further conditional statements if required), executed if the '''conditions''' are met. |
||
Example: |
Example: |
||
Line 26: | Line 45: | ||
</dict> |
</dict> |
||
− | == |
+ | === else === |
− | Actions performed when conditions are not met. Same as "Do". |
||
− | |||
− | {{Stub}} |
||
− | |||
− | |||
+ | '''else''' consists of an array of actions (and further conditional statements if required), executed if the '''conditions''' are NOT met. |
||
+ | Example: |
||
+ | <key>else</key> |
||
+ | <dict> |
||
+ | <array> |
||
+ | <string>addShips: super-pirate 1</string> |
||
+ | </array> |
||
+ | </dict> |
||
− | -------------------------------------------------------------------------------- |
||
+ | ---- |
||
[[Category:Oolite]] |
[[Category:Oolite]] |
||
[[Category:OXP_howto]] |
[[Category:OXP_howto]] |
Revision as of 18:21, 24 January 2006
script.plist Used by missions and OXP's to check conditions and perform scripted actions accordingly.
In OXP's it can provide Oolite with additional information to generate and populate customised systems.
Structure
script.plist's structure is a dictionary, each entry is a particular script with a unique key.
Each script is an array of actions and conditional statements that are executed or checked at regular intervals (every 10 seconds or so during flight).
Actions
An action is a simple string referring to a method
Conditional statements
Conditional statements consist of a dictionary with entries for the keys conditions and do (and optionally else.)
conditions
conditions consists of an array of tests to be performed. Each test checks whether the current status of one of a number of queriable states and mission_variables are equal, lessthan, greaterthan a given value or state, or oneof a list of comma separated states.
Multiple conditions may be specified, a logical 'AND' is applied to determine whether the conditions are met or not.
If all the conditions are met then the do' entry is executed, if any are not met then the else entry is executed (if it exists).
example:
<key>conditions</key> <dict> <array> <string>shipsFound_number equal 0</string> </array> </dict>
do
do consists of an array of actions (and further conditional statements if required), executed if the conditions are met.
Example:
<key>do</key> <dict> <array> <string>addShips: asp-cloaked 1</string> <string>addShips: pirate 12</string> </array> </dict>
else
else consists of an array of actions (and further conditional statements if required), executed if the conditions are NOT met.
Example:
<key>else</key> <dict> <array> <string>addShips: super-pirate 1</string> </array> </dict>