timer question
|
|
Random Torok
Registered User
Join date: 19 Mar 2007
Posts: 33
|
10-02-2007 20:46
Hey everyone;
Can a single script have multiple timers?
I have a cool digital clock script but it only increments the seconds 2 at a time.
I was thinking I'd create separate functions to set the seconds, minutes and hours.
All suggestions greatly appeciated
RT
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
10-02-2007 21:18
1 timer per state
fast timers can also be bad, its not really the timer, just what happens when the timer fires, ie 3 pages of crap ever 0.05 seconds
also just count the time, or use a function that returns a time/date stamp every so often
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
10-02-2007 23:17
multiple simultaneous timers...
use several scripts. One for hours, one for minutes, one for seconds.
|
|
Aaron Edelweiss
Registered User
Join date: 16 Nov 2006
Posts: 115
|
10-03-2007 03:43
Post you're script. You certainly don't need more than one script or timer for a clock of any kind. Using multiple scripts is wasteful in this case.
|
|
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
|
10-03-2007 04:37
Its actually one timer per script, timers persist ove changes of state.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-03-2007 09:21
fire a timer every second and then add 1 to an integer everytime, with an if statement saying if(integer ? == 60){does minute stuff} etc, so on and so on.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
10-03-2007 13:49
From: Jesse Barnett fire a timer every second and then add 1 to an integer everytime, with an if statement saying if(integer ? == 60){does minute stuff} etc, so on and so on. small problem with that... timers are subject to time dilation... so eventually the scripted clocl is slower and slower compared to actual time.... there's lots of clock scripts out there, but updating is going to happen when the sim feels like it... sim runs slow, clock updates slow.... do you REALLY need seconds?
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-03-2007 14:38
From: Void Singer small problem with that... timers are subject to time dilation... so eventually the scripted clocl is slower and slower compared to actual time....
there's lots of clock scripts out there, but updating is going to happen when the sim feels like it... sim runs slow, clock updates slow.... do you REALLY need seconds? I do agree, this one isn't very sim freindly and wouldn't have worked all that well. But at the same time I was showing how you can use one timer to perform multiple time events.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-03-2007 16:12
Here is a little demo script showing how you can use 1 timer event to do multiple things: integer mult_timer;
default { state_entry() { llSetTimerEvent(10.0); } timer() { mult_timer++; if(mult_timer == 3) { llSay(0, "1/2 minute"); } else if(mult_timer == 6) { llSay(0, "1 minute"); mult_timer = 0; } else { llSay(0, (string)mult_timer + "0 seconds"); } } }
That would output: new: 10 seconds new: 20 seconds new: 1/2 minute new: 40 seconds new: 50 seconds new: 1 minute new: 10 seconds etc............................
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
10-03-2007 17:49
i still cant imagine why anyone would actually want to count seconds for a clock, just get a timestamp, then even if your clock suffers timer drag the data will still be correct
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-03-2007 20:07
At one point I had a clock that I made on screen as a hud that showed my local time. I stopped using it and couldn't imagine pinging the server with a llGetWallClock every minute for the whole time I am in game anymore. Still a good learning expirience but not exactly sim freindly.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|