ID:270153
 
how would i make a code that would count down and do something when it reachs 0:0:0 ive tried this system sevral times but i wont work.
Try this not sure if it works though I havent tested it.
proc
Count_Down(hour,min,sec,tnth)
while(hour||min||sec||tnth)
if(!tnth&&sec)
sec--
tnth = 9
else if(!sec&&min)
min--
sec = 59
else if(!sec&&!min)
hour--
min = 59
else tnth--
world << "[hour]:[min]:[sec]:[tnth]"
sleep(1)
In response to Drumersl
Hmmmm... Well, you could set a variable for the base time, then wait one second, subtract 1, and loop through it.

proc
Countdown()
var/Time = 60//set a base var
if(Time == 60) //this will happen only at the beggining
world << "The countdown has begun!"
Time -= 1//take away one
if(Time == 0)//if there is no time left
world << "Time's up!"
return //stop the proc
else//otherwise
sleep(10)//wait a sec
Countdown() //call the proc again

That's just a very basic way of doing it.