2.5.4 Use BScript Commands
Example of two REPEAT loops (one nested) using just the default counter value for comparison:
REPEAT,
PX=0,OK
PY=0,OK
PZ=0,OK
PU=0,OK
REPEAT,
PX=0,OK
PZ=0,OK
UNTIL=3,
UNTIL=10,
The outside loop will loop 10 times. The inside loop will loop 3 times , but because the outside loop iterates 10 times it will actually run 30 times.
A math comparison using a reply value would look like this:
JX-,OK
REPEAT,
EP,
RSAVE1,
UNTILR1000:2000,
STOP,OK
Assuming the EP values start at 0000:0000:0000:0000 the program above should loop until the first value returned from EP is between 1000 and 2000 and then the loop ends and the STOP command is executed.
The UNTILR command is inclusive, meaning the value is valid if not only between the two range values but also including the range values themselves.
The RSAVE# command will return a reply of what the actual value it stores in memory from the previous reply value. I need to change what displays in the window, since it current says SREPLY, not RSAVE#. I originally had the command be SREPLY, but changed it to RSAVE.