Execution Flow Commands

These are commands related to the basic running of the script.

 

Command

Description

inst Makes the rest of this macro execute in a single tick, useful for making new objects install instantly and without interruptions.
stop Stops execution of the script, can be placed within the body of the script
endm Compulsory command at the end of a script, and only at the end.
wait n Wait for number of  ticks before continuing with the next instruction.
A tick is approximately 1/10th of a second.
 
 
subr label Identifies the start of a subroutine. 'label' is a 4-char name for that sub routine.
If this is reached after normal commands, it is treated as the stop command. gsub will jump to the line immediately after this one.
gsub label Jumps to the subroutine with the given label. The program often has to scan the entire script for the subroutine start, but always remembers the address of the last subroutine visited, so subroutines will execute quickly in loops.
retn Returns from a subroutine to the next line after the gsub command that sent it there.
 
 
reps # Makes the program repeat the following code # times, up to next REPE.
Note: repeats may be nested, but these loops must not be jumped out of.
repe Marks the end of the repeated commands set up by reps, and defined by reps
 
 
loop Loop tells the program to repeat the following commands until it reaches an ever or untl command.
untl value1 condition value2
This repeats the loop unless the condition is found to be true.
Valid conditions are:

EQ - equal to
NE - not equal to
GT - greater than
LT - less than
GE - greater than and equal to
LE - less than and equal to
BT - Boolean true (?)
BF - Boolean false (?)

For example: untl obv2  ne 1 this command will loop until object variable 2 does not equal 1. Remember that loops may be nested, but must not be jumped out of.

ever Repeats the loop forever, be careful using this command.
 
 
doif value1 condition value2  Do next set of instructions if condition is true, otherwise skip to the next else or endi
Valid conditions are EQ NE GT LT GE LE BT BF.
else This marks the next set of commands to be run if the doif command is found to be false. You do not need to have an else command, if one does not exist the program will skip to the next endi.
endi This ends the set of instructions relevant to the doif command.
 
 
enum family genus species Iterates through each object which conforms to the given classification, setting target to point to each valid object in turn.
Family, Genus and/or Species can be zero to act as wild cards.
This command loops at the next command until all objects of the given classification have been acted upon .

an example section of script:
enum 2 5 203
mvby 30 0
wait 20
kill targ
next
next Goes to the next object in the iteration set-up by enum.
 
 
dbug value Performs in an INSTANCE: sends value as a TRACE message that you can view on the debugger. A good use for this is to trace macro sequence of execution. Another use is to display data values, and a third is to put a breakpoint here, so that you can trace macro execution in code.
dbgm [string] Does nothing in release version, but debug version sends string as a TRACE message that you can view on the debugger.
This can be used to leave useful notes in the code.
dbgv valueSends Rvalue to debug window. Same as DBUG but does not  run in an instance.