Vizard 8 » Command Index » Vizard modules » viz » <viz>.starttimer
8.0

<viz>.starttimer

This command starts a one-time expiration timer

<viz>.starttimer(  
timerID # timer ID
expirationTime = FASTEST_EXPIRATION # expiration sign off on time
numRepeats = 0 # Number of repeats
)  
timerID
Specifies an integer valued timer ID. The default is to create a timer with ID equal to 0.
expirationTime = FASTEST_EXPIRATION
Specifies the expiration time in decimal seconds. The default is to create a timer than will expire at the maximum frame-rate.
numRepeats = 0
Specifies how many times to automatically repeat this timer event. If none is supplied then the timer will only occur once and addition cyles will have to be manually evoked by issuing another starttimer call. Passing viz.FOREVER will cause the timer to repeat forever.

Remarks

Use this command to begin an expiration timer. When the timer expires, Vizard will pass the registered timer handler function the timerID so that the script can know what timer expired. Keep in mind that timers expire only once, so for timer-based animations or other reoccurring events, it is necessary to re-create the timer each time it expires. There is effectively no limit to the number of simultaneous timers that can be created. Be careful, however, that only one new timer is ever created per timer expiration. It is a common Vizard programming pitfall to accidentally create more than one and thus end up with an exponentially increasing number of timers.

Return Value

None

Example

viz.starttimer(ANIMATE, 0.01)

See also

<viz>.callback
<viz>.killtimer
<viz>.elapsed
<viz>.play
<viz>.pause