Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Pausing a Timer?

Spins Stovall
Registered User
Join date: 11 Jun 2006
Posts: 2
06-14-2006 22:05
Hello,

Is ther any way to Pause a timer? I have a timer going and when I select the pause option I simply want to pause the timer. When I hit pause again , I want to restart the timer.

Looking at llSetTimerEvent() I don't see a way of doing this.

Thx
-Spins
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
06-14-2006 22:09
Only way I can think of "pausing" the timer is basically to reset it. Use llSetTimerEvent(0). This will turn off the timer, then do you code, then llSetTimerEvent(time), where time is your normal timer value. The Only down side of this is that it doesn't pause the timer, instead it sets it to 0, and doesn't fire the timer event. When you call llSetTimerEvent(time), the timer event will then fire after time seconds.

Another way to do this is to use a flag/boolean in the timer event, such as PAUSE, and put that in the timer event and use if(!PAUSE) or however you want to do it. Hope that helps you out :)
Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
06-14-2006 22:12
Well, one way of going about it would be to have a timer running at 1 second, and each second have it add 1 to a count variable. The pause button could stop the timer and count would still have the number of seconds passed so far in it.
_____________________
Archatek

Home to some of the highest quality katanas and other blades available in SL. Co-creator of the Samurai Island Combat System, one of the best melee combat systems available, come check it out!

___________________