SETTIMER

Synopsis
SETTIMER id delay callback
Description

Sets up a timer identified by id (a number from 1-31) to call the instructions in callback in delay milliseconds. It continues to "fire" every delay milliseconds until you invoke CLEARTIMER with the same id.

You can clear the timer at any time with CLEARTIMER. In particular, you can clear the timer in the callback instructions to create a one-shot timer event. You can also create a timer at any time, including in the callback instructions. Halting clears all timers.

Timers with id values from 1-16 run their callbacks in NOYIELD mode, which means they are not interrupted by user interaction and the screen isn't repainted if it becomes occulded when the callback is running. Timers with id values from 17-31 run their callbacks in the normal, interruptable mode.

Each timer id can have different values for callback.

Example
SETTIMER 17 200 [SETPENCOLOR (LIST RANDOM 256 RANDOM 256 RANDOM 256)]
FMSLogo is ready to run more instructions and the timer changes the pen color randomly every 200 milliseconds.
REPEAT 72 [REPEAT 4 [FORWARD 100 RIGHT 90] RIGHT 5]
CLEARTIMER 17

SourceForge.net Logo