Skip to content
lsl.devlsl.devLSL Dev

Timer

Looking for the current API? Open the timer reference →

Wiki description

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;
    • llSleep().
  • Only one timer can be active at one time.
  • The timer survives state changes, but does not survive resets.

Examples

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");
    }
}

See also: functions

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from Timer, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

  • Timer (revision 1194108, )

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.