The main loop
If you understand how each of the above building blocks works, it will be very easy to understand the higher level parts of the program. The program contains just one MultiTrack task, called ServerUpdate, apart from the transitory task used by the low level SCH_SetCommand function.
The ServerUpdate task incorporates 3 separate “tests”, which interact with the sandbox script on our server in 3 different ways. Each test is triggered by pushing a button. ServerUpdate contains a simple loop that sits looking for a button press. When one is detected it jumps to the corresponding code segment. Here’s that loop code:
WAFbutton:
Yieldtask
GoIfInK iBtnA,Test1
GoIfInK iBtnB,Test2
GoIfInK iBtnC,Test3
GoTo WAFbutton
Each code segment (test) does a GoTo back to WAFbutton when it is done.