Can a timer be stopped with any player input, but be restarted after say 15 seconds after being stopped if there is no further player input?
Share some code if you can...:)
Do you mean when the player types a command or clicks a link? It should possible, but would be a little unreliable on the online player because it depends how long it takes the player's input to reach the server.
I think that if you have a timer mytimer
, you could create another timer to handle the delay and call it something like pausetimer
, by making a turnscript doing something like:
realtimer = GetTimer ("mytimer")
DisableTimer (realtimer)
if (GetTimer ("pausetimer") = null) {
create timer ("pausetimer")
pt.interval = 15
pt.script => {
if (not realtimer = null) {
if (not realtimer.enabled) {
realtimer.trigger = game.timeelapsed + this.remaining
realtimer.enabled = true
}
}
this.enabled = false
}
}
else {
pt = GetTimer ("pausetimer")
}
EnableTimer (pt)
pt.remaining = realtimer.trigger - game.timeelapsed
So you want a timer that goes off after 15 seconds, unless the player offers input?
Here is my game code:
DisableTimer (Start Timer)
msg ("This stops the timer.")
Edit: Here is the screenshots!
https://imgur.com/pTd6Di4
https://imgur.com/T3wDB1Z
DisableTimer (Start Timer)
My brain just got stuck in a while
loop!
Hello, jmne!