Difference between revisions of "Timer"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 6: Line 6:
** '''Time dilation''' -  See [[llGetRegionTimeDilation]] for more information.
** '''Time dilation''' -  See [[llGetRegionTimeDilation]] for more information.
** '''Default event delay''' - Only so many events can be triggered per second.
** '''Default event delay''' - Only so many events can be triggered per second.
** '''Event Execution''' - If the execution of an event takes to long.
** '''Event Execution''' - If the execution of an event takes too long.
*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:56, 7 November 2008

Description

Event: timer( ){ ; }

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


Caveats

  • The time between timer events can be longer than that specified with llSetTimerEvent, this is caused by:
    • Time dilation - See llGetRegionTimeDilation for more information.
    • Default event delay - Only so many events can be triggered per second.
    • Event Execution - If the execution of an event takes too long.
  • 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(  );