ID:139796
 
Code:
        Owner_Reboot()
set category = "Owner"
set name = "Owner Reboot"
switch(input("Are you sure you want to reboot?","Reboot", text) in list ("No","Yes"))
if("No")
return
if("Yes")
switch(input("When do you want to reboot?","Reboot", text) in list ("Cancel","Now","30 Seconds","5 Seconds","Set"))
if("Cancel")
return
if("Now")
world.Reboot()
if("30 Seconds")
sleep(250)
world << "Rebooting in 5 seconds"
sleep(10)
world << "Rebooting in 4 seconds"
sleep(10)
world << "Rebooting in 3 seconds"
sleep(10)
world << "Rebooting in 2 seconds"
sleep(10)
world << "Rebooting in 1 second"
sleep(10)
world << "Rebooting now"
world.Reboot()
if("5 Seconds")
world << "Rebooting in 5 seconds"
sleep(10)
world << "Rebooting in 4 seconds"
sleep(10)
world << "Rebooting in 3 seconds"
sleep(10)
world << "Rebooting in 2 seconds"
sleep(10)
world << "Rebooting in 1 second"
sleep(10)
world << "Rebooting now"
world.Reboot()
if("Set")
var/X = input("When do you want to reboot?","Reboot") as num
if(X == null)
return
if(X < 0)
return
if(X == 1)
world << "Rebooting in [X] seconds"
sleep(10)
world << "Rebooting now"
world.Reboot()
if(X > 1)
var/C
C = X/(1/10)
world << "Rebooting in [(C)/10] seconds"
sleep(C)
world << "Rebooting in 5 seconds"
sleep(10)
world << "Rebooting in 4 seconds"
sleep(10)
world << "Rebooting in 3 seconds"
sleep(10)
world << "Rebooting in 2 seconds"
sleep(10)
world << "Rebooting in 1 second"
sleep(10)
world << "Rebooting now"
world.Reboot()


Problem description:

So.. I have a reboot verb.. but I don't know how byond timing works, so can someone help me... when I do "Set Reboot" it reboots at the time of "X" seconds.. but then it says 5 4 3 2 1.. how do I make it so it does it at w/e time I do it at then when it reach 5 seconds, it'll count down? Should I add 50 to "C = (X/(1/10))+50"? Can someone explain to me the timing of byond?
The unit of time is a tick. One tick is 1/10th of a second.
In response to Garthor
So.. if I put in 50... it'll be 5 seconds? or ...?
In response to NarutoBleach
Yes, sleep(10) is 1 second.

Also, for an easier methodology to that system:
mob/verb/rebootworld()
set name = "Reboot"//Set the name
switch(input("Are you sure you want to reboot?","Reboot", text) in list ("No","Yes"))
if("No")
return
else
var/time = input("Seconds until reboot.") as num//input # val of time
if(time <= 0)//If time is 0 or below, don't go through with it
return
time*=10//Multiply the 1/10 of a second value by 10
while(time > 0)//While time is greater than 0
world << "Rebooting in [time / 10] second\s"
time -= 10
sleep(10)
if(time <= 0)//if time is less than or equal to 0
world << "<big>Rebooting!"
world.Reboot()//Reboot the world