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 of time. It will continue 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 will not allow the callback code to yield. Timers with id values from 17-31 will yield.

Each timer id can have different values for callback.

Example
SETTIMER 1 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 1

SourceForge.net Logo