setTimer()
Purpose
Create a new timer
Description
Create a new timer which is used to call a function a number of times with a fixed interval
Syntax
handle = setTimer( interval, count, functionName( arguments ) )
Arguments
handle The handle of the timer
interval The interval between each function call
count The number of times to call the function
functionNameThe function to call
arguments The arguments to pass to the function
Example
count = 10
handle = setTimer( 1, 11, showCount() )
stopTimer( handle )
loop
c = controls( 0 )
printAt( 0, 0, "Press A to start timer" )
if c.a then
startTimer( handle )
endIf
printAt( 0, 1, "Press B to stop timer" )
if c.b then
stopTimer( handle )
endIf
update()
repeat
function showCount()
clear()
textSize( 500 )
printAt( tWidth() / 2, tHeight() / 2, count )
textSize( 29 )
count -= 1
return void
Associated Commands