Hello, I was wondering how would i make a time limit for like game rounds and put it in the clients stat panal and make the time limit like 3:00 and it goes down from there in minutes.
Thanks
SaiyanBrad.
ID:177242
Oct 7 2002, 2:28 pm
|
|
In response to Garthor
|
|
It worked but it starts at 1000:220 and the 220 goes down how can i fix this?
Thanks SaiyanBrad. |
In response to SaiyanBrad
|
|
Oops... I botched something in there, gimmie a min
|
In response to Garthor
|
|
ok.
|
In response to SaiyanBrad
|
|
var/Time = 0
var/Seconds = 0 proc Timer(N as num) sleep(1) var/M = (N-N%60)/60 Time = 100*M + N%60 Seconds = N-1 if(N > 0) spawn(10) Timer(Seconds) world New() Timer(18000) mob Stat() stat("Time","[(Time-Time%100)/100]:[(Time%100-Time%10)/ 10][Time%10]") |
In response to Garthor
|
|
Thank you it works amazingly. Now is there a way so when it hits 0:00 it could do something like send you to a new map?
Thanks SaiyanBrad. |
In response to SaiyanBrad
|
|
There's already a check for the 0:00 thing. Just put else after the last line in the proc, and put anything you want it to do after that.
|
In response to Garthor
|
|
Garthor wrote:
mob There's actually a more compact way you can write that--which I used in Scream of the Stickster: var/t = endofround - world.time Thus, the 10s digit of the number of seconds can be found simply by dividing ticks by 100--which gives you units of 10 seconds each--and taking modulo 6 (so it goes from 0 to 5). For the 1s digit you divide by 10 (for 1-second units) and modulo 10. You could use the same technique to show h:mm:ss format: stat("[(t/36000+11)%12+1]:[t/6000%6][t/600%10]:[t/100%6][t/10%10]") [EDIT] Actually, now that I've taken a second look at it, this piece of code you posted is really awful: proc A few problems here: First, your sleep() and spawn() calls are really cryptic and they look like they'll measure very inaccurately (especially given BYOND's present spawn() bug); why you're not working with world.time I'll never know. Second, you're reformatting that number in a really bizarre way, just so you can reformat it again in your Stat() proc. If you can modulo and divide out 100 in that, why can't you do it with 60? The line "Time = 100*M + N%60" is friggin' goofy; keep your vars simple, and either break up hours, minutes, seconds, etc., or just keep it all straight in a total count of seconds or ticks. Lummox JR |
In response to Lummox JR
|
|
I was preoccupied at the time. =P
|
var/Seconds = 0
proc
Timer(N as num)
var/X = N
while(X%100 > 60)
X += 10040
Time = X
Seconds = N-1
if(N > 0) spawn(10) Timer(Seconds)
world
New()
Timer(180)
mob
Stat()
stat("Time","[Time-Time%10000]:[Time%10000]")
That SHOULD work, but it's untested. Just pass a value in seconds through the Timer() proc to start the timer.