Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

timer event problem

Douglas Callahan
Fresh Prince Of SL
Join date: 2 Jul 2004
Posts: 349
09-03-2004 21:14
If I make a script with a llSetTimer function and a timer() event, sometimes when i use it, the timer goes up right away, but it is set to go at 30 seconds or something. Please help me fix this problem, it's an annoying one.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
09-03-2004 22:56
What do you mean by "the timer goes up right away"?
Is it triggered right away?

There's really not much debugging I can help you with without a snippet of the problimatic code. You can try looking for places in the script that call llSetTimerEvent, as that's the only way the timer interval can be changed; when you find all calls to llSetTimerEvent, you find all possible sources of the bug you're seeing.
==Chris
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
09-03-2004 23:28
Bear in mind that the timerevent time-till-next-event is (I think) conserved between rezes, so if you "Take" the object after 28 seconds then rez it the next day, the timer will fire after 2 seconds.

Azelda
_____________________
Douglas Callahan
Fresh Prince Of SL
Join date: 2 Jul 2004
Posts: 349
reply
09-04-2004 09:58
Yes, I mean that the timer is triggered right away, even though the code is set not to. For Example:

llSetTimerEvent(60);
}
}

timer()
{
llSay(0, "You took too long to respond, sorry. Please play again.";);
llGiveMoney(player, 20);
state default;
}

What happens is that the first time I play the game, the timer is triggered instantly, but the second time it works fine. If noone plays the game for a few minutes, then plays, then the timer is triggered instantly the first time again, but the second game works fine.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
09-04-2004 12:29
You might not be shutting down the timer when a person stops playing the game. If you dont, it keeps on ticking.

Ah, I see you have a state change there. Ill run some tests on llSetTimerEvent and state-change persistance. That might be your problem.

If it is, just stick llSetTimerEvent(0) in state_exit of the state with the timer event.
==Chris
Douglas Callahan
Fresh Prince Of SL
Join date: 2 Jul 2004
Posts: 349
timer event problem
09-04-2004 13:13
Sorry, I couldn't quite understand where you said to put the state_exit, could you give me an example?
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
Re: timer event problem
09-04-2004 13:21
From: someone
Originally posted by Douglas Callahan
Sorry, I couldn't quite understand where you said to put the state_exit, could you give me an example?

CODE

state foo {
state_exit() {
llSetTimerEvent(0);
}
}