StopTask() - The Stop Task Command
The StopTask() command stops one or more tasks that are running or paused on the same device.
This command is the opposite of the StartTask() command and functionally identical to the CancelTask() command.
You cannot start a task until it has been stopped or completed. Use this command to stop a task like a timer or chase so you can start it over. |
Syntax
Basic Use
StopTask(x)
Where "x" is the task you want to stop.
Can be any value 1-254 or "ALL" to stop all tasks currently running or paused.
Advanced Use
StopTask(x,y,z,…n)
This allows you to stop multiple tasks with a single command. However, this technique will only work with tasks numbered 16 or less. To stop a higher numbered task you must use the basic version.
Examples
Example 1
A basic use of the command to stop a single task.
{
Start(0x1c,250,x,x,x,x,x) //Watches all 1C messages for our trigger area.
copy @0,~0,7 //Copy the msg to ~0-6. ~1 is area, ~3 is preset.
LDA ~3 //Get preset byte (opcode)
CMP #0x00 //Is it a message for preset 1?
BRZ P1 //If it matches branch. If not continue.
CMP #0x01 //Is it a message for Preset 2?
BRZ P2 //
CMP #0x03 //Is it a message for Preset 4?
BRZ P4
Null //Stop. Do not pass go. Do not collect $200.
P1:
StopTask(3) //Stop the rainbow chase task.
StartTask(2) //Start the color fade task.
Null
P2:
StopTask(2) //Stop the colorfade task.
StartTask(3) //Start the rainbow chase task.
Null
P4: //Stop all chases
StopTask(2) //Stop the colorfade task.
StopTask(3) //Stop the rainbow chase task.
Null
}