Creating a Countdown Timer

There used to be a TV program called the Crystal Maze where a team had to recover crystals from different rooms by doing certain challenges. Each person had to do a challenge and the difficult bit was that they only had 5 minutes to do it before the room was locked.

Important note: in Quest 5.3 the object ‘player’ is replaced with ‘game.pov’ so if you are working with Q 5.3 or higher replace ‘player’ with ‘game.pov’

  1. I have set up two rooms in Quest. One room is called Dungeon where the challenge is set.

In the room are lots of different objects:

  1. The first thing I need to do is make a Countdown variable and set it to the time I need

  2. I highlight the player and go to Attributes and click the Add symbol.

  3. I give the Attribute a single word name eg: countdown (CASE SENTITIVE!)

  4. When I click OK it appears at the bottom:

  5. I now need to give the countdown variable a value.

  6. I click on the String drop down box and choose Integer and type the number of seconds I want the clock to run for in the box:

  7. When you click off you see that the attribute now says 30 next to it:

  8. Now I need to add a label so the value appears when you play.

  9. I go up to status attributes and click the Add button and type in the name of the attribute: (CASE SENTITIVE!)

  10. When I click OK I am asked for a Format string. You can leave this blank and the computer will put in countdown: 30

  11. If you want to have a different value, type in the words you want and put a ! where the seconds will go eg

  12. This would look like this when the game runs:

  13. When you click OK you will see the different attributes:

  14. The next step is to add the Timer

  15. I do this by going to Add > Timer and giving it a name:

  16. Next I need to tell the computer to start on 30s and countdown in steps of 1.

  17. I do this by clicking on Script typing in variable and choosing Set a variable or attribute:

  18. I double click on the script to choose it and it looks like this:

  19. I now CAREFULLY type in the name of my variable – player.countdown (Q5.3: game.pov.countdown)

  20. In the expression box I type in the same variable but then with MINUS 1 eg player.countdown -1 (Q5.3: game.pov.countdown -1)

  21. This basically tells the counter to countdown from 30 it steps of 1

  22. Now I add in another script using IF to say what happens if the counter gets to 0

  23. Next we need to tell the computer to start the timer when we go into the Dungeon.

  24. Click on Dungeon then Scripts and find the After entering room section.

  25. Add a script and search for Enable. Enable Timer1 to start:

  26. Next we need to tell the computer to stop the time when the Dungeon.

  27. Click in the Dungeon room and select scripts.

  28. Find the After leaving room section and make up these scripts:

  29. This tells the computer to stop the timer running, write a message and then “reset” it back to 30 when you leave the Dungeon

  30. Run the game. When you go into the room, the timer starts automatically:

  31. Here is the timer counting down some more

  32. Here is the game finished when I did not get out in time

  33. Here is when I get out of the room and go back to the other room – the timer resets to 30s

  34. If you wanted the timer on for the entire game you would go back to the timer and tick the start timer when game begins box

I AM SURE THERE ARE LOTS OF OTHER THINGS YOU CAN DO WITH THIS CODE!