This is a countdown that will appear below the compass. When the countdown gets to zero, the game ends.

The counter is in JavaScript, running in the browser, so not using the Quest timer system at all. This means it can be fast, and will display tenths of a second. Events are triggered at various points (every 30 seconds, but it could be at any arbitrary time), with the final event at time zero terminating the game.

This is a complete example game (there is not much to it apart from this system). You cannot actually do anything except look in wonder at it for 2 minutes, after which is will end.

<!--Saved by Quest 5.6.6108.15891-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="countdown">
    <div id="clock">
          <td style="font-family:monospace;font-weight:bold;font-size:24pt;text-align:right;" id="time"></td>
      d = new Date();
      startTime = d.getTime() + 2 * 60 * 1000;
      myVar = setInterval(myTimer, 100);
      event1 = { time: 90000, message: "This happened", done: false };
      event2 = { time: 60000, message: "Then this", done: false };
      event3 = { time: 30000, message: "And then this!", done: false };
      event4 = { time: 0, message: "stop", done: false };
      events = [ event1, event2, event3, event4 ];

      function myTimer() {
        timeNow = new Date();
        lapsed = startTime - timeNow.getTime();
        if (lapsed < 0) {
        else {
          minutes = Math.floor(lapsed / 60000);
          sMinutes = "00" + minutes;
          lapsedSeconds = lapsed - minutes * 60000;
          sSeconds = "0000" + (Math.round(lapsedSeconds / 100) / 10).toFixed(1);
          $('#time').html(sMinutes.substr(-2) + ":" + sSeconds.substr(-4));
        for (var i = 0; i < events.length; i++) { 
          if (!events[i].done && events[i].time > lapsed) {
            ASLEvent('HandleEvent', events[i].message);
            events[i].done = true;
    <roomenter type="script">
      JS.addText (game.js)
      JS.eval ("$('#clock').insertAfter($('#compassAccordion'))")
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
  <function name="HandleEvent" parameters="s">
    if (s = "stop") {
    else {
      msg ("A message from the timer: " + s)

I'm sure this will prove very useful for many, but it looks like Hieroglyphics to me. I could spend a lifetime trying to learn JS and never get there.

Anyway, I kind of wish I'd been a bit more patient and waited for this before submitting a game that uses Quest's unreliable wait scripts. It would have needed many tweaks before it did what I want, but I'm sure it could have been adapted.

It was your requests that inspired it.

I suspected so and hope my first sentence didn't come across as ungrateful. I hadn't realised you were planning this and I was growing impatient to get my game finished.

Out of interest, would this have been easy enough to tweak so that it does what my game does now, namely do away with the countdown display and have a sound/message triggered at intervals, then move the player to a game over room at zero?


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