ID:269288
 
1. How would I make a timer? Just a simple one that will count down when activated.

2. Is it possible to make a switch statement with map text(on screen text)?

Your help would be greatly appreciated.

One more thing, is there a tutorial or built in proc that can help alleviate lag, or should I just use a lag guard already made by someone else?

There is a tutorial on BYONDscape(by Lummox JR) about cpu usage.

As for your first problem; you need to be more specific.

One approach could be to use a loop:

mob/proc/Countdown()
var/time = 10
while(time) //as long as time as above 0
world << "[time] second/s left until blast off"
time --
sleep(10) //wait 1 second before doing everything again
world << "BLAST OFF!" //this is called when the loop finishes.


Another would be:

mob/proc/Reboot()
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.Reboot()
In response to DeathAwaitsU
So is it possible to put a switch statement in on screen text?
Example:
switch(input("Whatever") in list ("Yes", "No"))
In response to Mecha Destroyer JD
Mecha Destroyer JD wrote:
So is it possible to put a switch statement in on screen text?
Example:
> switch(input("Whatever") in list ("Yes", "No"))
>


You mean on client.screen, or like,
src<<"Would you like to eat pie? (Y/N)"

Both are possible.
In response to DeathAwaitsU
DeathAwaitsU wrote:
> mob/proc/Countdown()
> var/time = 10
> while(time) //as long as time as above 0
> world << "[time] second/s left until blast off"
> time --
> sleep(10) //wait 1 second before doing everything again
> world << "BLAST OFF!" //this is called when the loop finishes.
>



A way so you don't have to do a new while loop for everytime (unless you really want the text):
var
const
second=10
minute=600
hour=36000
proc
timer(unit=second,time=second,timedown=1)
time/=10
while(time)
sleep(unit)
time-=timedown
return 1
mob
verb
test()
while(!timer(second,minute*2))
world<<"It's been two minutes!"