CAOS Language Guide
Execution Flow Commands
|
Macro |
Description |
|
These commands all alter the normal control flow through a macro script or allow you select a new TARG object.
|
|
|
ENUM family genus species NEXT |
Enumerate across all objects matching the specifierNote: All commands between ENUM and NEXT run as INST. TARG is returned to OWNR (in event scripts) after enumeration.Command only |
|
ESEE family genus species NEXT |
Enumerate across all specified objects that can be seen by the owner object. Note All commands between ESEE and NEXT run as INST. TARG is returned to OWNR (in event scripts) after enumeration.Command only |
|
ETCH family genus species NEXT |
Enumerate across all specified objects that are touching the owner object. Note All commands between ETCH and NEXT run as INST. TARG is returned to OWNR (in event scripts) after enumeration. Command only |
|
ESCN family genus species NSCN |
Enumerate all specified scenery objects. Command only |
|
STAR family genus species |
Can See Target Random. Pick a random object from those objects that match the given family genus species and can be seen by the Owner object. Implemented as a command only; the result is placed in object pointer Targ. Note: this command is computationally expensive. Command only |
|
RTAR family genus species |
Randomly selects a member that matches the specifier and sets it as TARG. Null if no member exists. Command only |
|
INST |
Make the rest of this macro execute in a single tick. This is used to ensure the creation of an object (for example) is not interrupted during the scheduling of concurrent scripts. Command only |
|
SLOW |
Negates previous INST command, returns control flow to normal execution. Command only |
|
STOP |
Stop execution of this macro script. Command only |
|
ENDM |
Compulsory command at end of macro script. Command only |
|
SUBR label |
Identifies a subroutine. label is a 4 character unique label that allows the subroutine to be called using GSUB Command only |
|
GSUB label |
Move execution to the given SUBR label. Command only |
|
RETN |
Returns from a GSUB Command only |
|
REPS n |
Repeat the following code n times, up to the next REPE. Command only |
|
REPE |
End of repeat loop. Command only |
|
LOOP |
Top of a LOOP-UNTL or LOOP-EVER statement. Command only |
|
UNTL value1 relation value2 |
Part of a LOOP-UNTL statement. Repeat loop unless condition is true. Valid relations are: EQ – Equal NE – Not equal GT – Greater than LT – Less than GE – Greater than or equal to LE – Less than or equal to BT – Bit-wise AND function BF – Bit-wise NAND function Command only |
|
EVER |
Part of a LOOP-EVER statement. Repeat loop forever. Command only |
|
DOIF value1 relation value2 |
Do next instruction of the condition is true, otherwise skip to after nested ELSE or ENDI. Valid relations are: EQ – Equal NE – Not equal GT – Greater than LT – Less than GE – Greater than or equal to LE – Less than or equal to BT – Bit-wise AND function BF – Bit-wise NAND function Command only |
|
ELSE |
If reach an ELSE because previous DOIF was true then jump to ENDI, otherwise DOIF was false so carry on processing from here. Command only |
|
ENDI |
Marks end of DOIF or DOIF-ELSE statement. Command only |
|
WAIT ticks |
Wait for the specified number of game ticks before continuing with next instruction. A tick is roughly 1/10 sec. Command only |