In this reference we use a consistent syntax for all commands. If some commands do not coincide completely with the meaning of an element described here, it will be pointed out in the corresponding thread.
List of syntactic elements
<RetVar/IF> = This statement precedes a command returning a value, which can be either saved in a variable or used as a condition.
Example
<RetVar/IF> <RefObj> -> get amount of ware <Var/Ware> in cargo bay
- $amount = $ship -> get amount of ware $ware in cargo bay - saves amount in variable $amount
- if $ship -> get amount of ware $ware in cargo bay - uses the commands return value for an if-statement
- while not $ship -> get amount of ware $ware in cargo bay - uses the commands return value as a loop condition
If the START option is available, you can also choose to discard the return value but wait until the command returns nevertheless (see example).
Example
<RetVar/IF/START> speak array: <Value> prio=<Var/Number>
- START speak array $name prio=$prio - starts the command and directly continues execution, even though the command is actually still running
- $someVariable = speak array: $name prio=$prio - waits until the command returns and saves the returned value in the variable $someVariable
- = speak array: $name prio=$prio - waits until the command returns but discards its return value
Example
<RetVar> = convert number <Var/Number> to string
- $numberString = convert number 42 to string - 42 is a constant number, entered directly
- $numberString = convert number $someNumber to string - $someNumber is a variable which holds a number
Example:
<RetVar/IF/START> speak array: <Value> prio=<Var/Number>
- = speak array: $myArray prio=$prio - $myArray is a variable of type array and can thus be processed by the command
- = speak array: 124 prio=$prio - 124 is a number literal, which can be entered, but cannot be used for the command
[Note to others: If there are more elements to be included, please post them here.
Btw: How are constants like object classes marked (or should they be marked at all)? The Escriptor uses curly braces, e.g. {SIGNAL_LOADWARE}, which I find quite clear, but they might be confusing to beginners, since the ingame SE doesn't display them.]