Don't click here unless you want to be banned.

LSL Wiki : llSetTimerEvent

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are 38.107.191.111
llSetTimerEvent(float sec)

Sets the timer event to be triggered every sec seconds. Passing 0.0 (or just 0) stops further timer events.

The timer persists over state changes, but gets removed when the script is reset.
It should be noted that, perhaps due to event delay, you can't get more than 25 timer events per second. And so setting the interval lower than 0.04 has no real effect, except filling up the event queue.


default
{
    state_entry()
    {
        llSetTimerEvent(300); // five minutes: 5*60--no need to make LSL do this simple calculation
    }

    timer()
    {
        llOwnerSay("timeout");
//      llSetTimerEvent(0);   (to stop the timer)
    }
}

Calling llSetTimerEvent replaces any existing timer value, and resets the countdown. In other words, if you call llSetTimerEvent(n) every n-1 seconds, the timer() event will never fire.

To stop the timer, call llSetTimerEvent(0.0). It's good practise to do this in the state_exit() event of any state which uses a timer to avoid unintentionally having a timer running in the next state.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

functions | events | timer
There are 18 comments on this page. [Display comments/form]