Timers and Display

Hey! I have some timers set up in my game, as there are multiple phases that are timed on different clocks. The timers themselves work, but I was wondering if there was an easy way to display the value of how much time is left, as it's quite jarring when a timer you had no idea was even running goes off.

Thanks yall!


Timers have issues... You have a choice of having the timer run on the Quest server or on the player's PC.

Running it on the server is easy, just add a timer to your game, and have it fire every so often. However, if it fires to frequently, ot can mess up your game. Once a minutes should be fine, once a second is going to cause issues. If you want to show how many minutes are left, do it this way. Just add a countdown atytribute to the game object and given it a big number, then have the timer reduce it by one each minutes, and stop the game at zero.

game.countdown = game.countdown - 1
if (game.countdown < 1) {
  msg ("Game over!")
  finish
}

Running it on the player's PC is the only way to do it if you want a rapid countdown, but it requires JavaScript, and really you need to be using the desktop version to implement it. There is an example game here, which displays the remaining time, down to 0.1 of a second, so the player sees time disappearing fast!
https://textadventures.co.uk/forum/samples/topic/gz1msne3k0_mjvoj8vpubw/countdown


if you want to see a very convoluted but somewhat novel/crafty countdown timer that I did when I was first trying to learn this type of stuff:

http://textadventures.co.uk/forum/samples/topic/4162/countdown-timer-code

the code (syntax) probably needs to be updated... as it's old, and thus likely it will not work until it's updated... too lazy, lol

but, you can take a look at it, regardless.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums