[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar/IF> = Use a variable, if the command should return information. If a variable is used, the command will return 1 on success and 0 on failure.
<Var/Passenger> = The object you want to check, if it's a marine. 'Valid' objects are passengers and astronauts.
This command checks if the as <RefObj> selected passenger or astronaut is a marine.
You might be involved in a fight including boarding ships. After the fight a lot of astronauts are floating in space. Now you may want to check automatically, if those astronauts are marines. For the following example the variable $sector should contain the sector you wish to check.
$marines.arr = array alloc: size=0
$ship.arr = $sector -> get ship array from sector/ship/station
$size.ship.arr = size of array $ship.arr
|dec $size.ship.arr =
|$ship = $ship.arr[$size.ship.arr]
|$objectclass = $ship -> get object class
|if $objectclass == Astronaut
||if is marine: passenger/astronaut=$ship
|||append $ship to array $marines.arr
This example gets all ships in the selected sector (including astronauts), checks if the astronauts are marines and adds them to an array. Afterwards the array $marines.arr contains all marines in the current sector. Now you could command them to fly to one of your ships or collect them.
After ejecting a marine he will fly as an astronaut to the next friendly station in the current sector. If there is no station he simply stands still in space. After a failed boarding attempt the marine will fly to his homeship. Astronauts have to be referenced as ships.
- »» Trade Commands
- »» Passengers
<RetVar/IF> is marine: passenger/astronaut=<Var/Passenger>
- »» Passengers