
Commands - 90
ON TICK
Tasking Statement
SYNTAX: ON TICK n,t GOSUB line/label
ON TICK n,t GOSUB
PURPOSE: To cause periodic program branching.
REMARK S: This statement is used when periodic tasks must be executed. The GOSUB is executed every t
seconds. n is the tick number and ranges fr om 0 to 2. Up to 3 ON TIC K subrou tines can exec ute
simultaneously.
There are three TICK timers in CAMBASIC. The parameter n ranges from 0-2. The TICK timers
are independent of each other.
The range of t is 0.005 to 327.68 seconds. The GOSU B branch occurs every t seconds unless the
second syntax is executed. Not specifying a line number or label after GOSUB disables the ON tick
subroutine.
Every t seconds an interval flag is set. At the conclusion of the current CAMBASIC command, a
GOSUB branch occurs.
See Multitasking Chapter for more information.
RELATED: CLEAR TICK, TICK
EXAMPLE: 10 ON TICK 1, 1 GOSUB 50
20 PRINT "*"
30 FOR X=0 TO 600:NEXT
40 GOTO 20
50 PRINT TICK(1)
60 RETURN
ERROR: < Data negative> – for t and n
< Data out of range> - if n > 2
< Time> 327.67 sec> - for t
< Can’t compile> – if line/label does not exist
Commenti su questo manuale