-Thanks

These forums are CLOSED. Please visit the new forums HERE
countdown please! |
|
Douglas Callahan
Fresh Prince Of SL
![]() Join date: 2 Jul 2004
Posts: 349
|
02-26-2005 19:11
Could someone help me make a countdown for my new game. I am currently using one that uses llGetWallclock(), but I do not want the timer to end at midnight. I want it to end at 3:00 or 5:00 or something. I also need the clock to reset when it reaches the timer, not go into the negatives, and also notify another script that the time is up. I would basically like to do what all of antagonistic protagonists games do - go to chaos gaming theory to see an example.
-Thanks ![]() |
gene Poole
"Foolish humans!"
![]() Join date: 16 Jun 2004
Posts: 324
|
02-27-2005 08:50
Consider the idea of relative time. That is to say, you could for instance do:
CODE
But as for timing out and notifying another script, you can just use the timer event itself. See here for more info: http://secondlife.com/badgeo/wakka.php?wakka=timer |
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
02-27-2005 09:38
llGetTime() will tell you how long a script has been running, although it is not very accurate IIRC. You could set the count down and subtract from the right number of seconds to give you the time remaining.
|
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
|
02-27-2005 10:21
Heya Douglas,
edit - check out the wiki TimeElapsed and Timer Enhancer , too... I've worked with countdowns for ages and taking several different approaches. Originally I started with timers and used llSetTimerEvent(60) or whatever... and had a countdown in the timer, like this (apologies in advance for the horrid formatting): CODE
... Of course, everyone knows that timer events really lag out in high traffic times, so I migrated to using a timer event that would run every 1 second and check against the script reset time with llGetTime() The problem with that method is that every time the sim goes down (for maintenance or whatever), the script time gets reset to 0, which is most annoying - especially when you're dealing with payouts The method I have been using lately uses a stored timestamp with llGetTimestamp() and a timer event that runs every second (because 1 second timers in high traffic areas are about as accurate as you can get) to compare the current timestamp with the original. I use a list to parse out the important details like: CODE
... Hope that helps some Douglas - gis a shout in-game if you want some code examples. --Jack Lambert |
Douglas Callahan
Fresh Prince Of SL
![]() Join date: 2 Jul 2004
Posts: 349
|
02-27-2005 10:38
gene, in your script you say integer oldTime = llGetWallclock(), then on the next line deltaTime = llGetWallclock - oldTime. oldTime is llGetWallclock(), so it will always return 0.
I also need the script to break up into hours, minutes and days. Thanks again. ![]() |
gene Poole
"Foolish humans!"
![]() Join date: 16 Jun 2004
Posts: 324
|
02-27-2005 20:15
gene, in your script you say integer oldTime = llGetWallclock(), then on the next line deltaTime = llGetWallclock - oldTime. oldTime is llGetWallclock(), so it will always return 0. I also need the script to break up into hours, minutes and days. Thanks again. ![]() True, but the "// time passes..." comment was meant to imply that various other processing (including the end of the function and the start of a new one) happens in between the two calls, so the delta will be non-zero. To be clear: CODE integer oldTime = 0; As far as divvying up into hours, minutes, seconds, days, etc... just do a little math, perhaps like this: CODE // i'm not even sure if this works, but it's mostly to give the notion, rather than an actual solution |
Douglas Callahan
Fresh Prince Of SL
![]() Join date: 2 Jul 2004
Posts: 349
|
02-27-2005 23:06
Wow. Thanks alot.
![]() |
gene Poole
"Foolish humans!"
![]() Join date: 16 Jun 2004
Posts: 324
|
02-28-2005 10:26
My pleasure. As always, IM me in-world with questions if you like; if I don't respond, I'm probably AFK-but-forgot-to-mark-myself-away or whatever.
|