Difference between revisions of "Timer"

From Second Life Wiki
Jump to navigation Jump to search
m (lsl code tagging)
m
Line 2: Line 2:
|constants
|constants
|spec
|spec
|caveats=*The timer event is adversly effected by [[llGetRegionTimeDilation|time dilation]].
|caveats=*The timer event is adversely effected by [[llGetRegionTimeDilation|time dilation]].
*Only one timer can be active at one time.
*Only one timer can be active at one time.
*The timer survives state changes, but does not survive resets.
*The timer survives state changes, but does not survive resets.

Revision as of 18:49, 21 May 2008

Description

Event: timer( ){ ; }

Repeats the code in the timer(). Result of the llSetTimerEvent library function call.


Caveats

  • The timer event is adversely effected by time dilation.
  • Only one timer can be active at one time.
  • The timer survives state changes, but does not survive resets.


Examples

<lsl> float gap = 2.0; float counter = 0.0;

default {

   state_entry()
   {
       // Activate the timer listener every 2 seconds
       llSetTimerEvent(gap);
   }
   timer()
   {
       counter = counter + gap; 
       llSay(0, (string)counter+" seconds have passed");
   }

} </lsl>

See Also

Functions

•  llSetTimerEvent

Deep Notes

Signature

event void timer(  );