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’
In the room are lots of different objects:
The first thing I need to do is make a Countdown variable and set it to the time I need
I highlight the player and go to Attributes and click the Add symbol.
I give the Attribute a single word name eg: countdown (CASE SENTITIVE!)
When I click OK it appears at the bottom:
I now need to give the countdown variable a value.
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:
When you click off you see that the attribute now says 30 next to it:
Now I need to add a label so the value appears when you play.
I go up to status attributes and click the Add button and type in the name of the attribute: (CASE SENTITIVE!)
When I click OK I am asked for a Format string. You can leave this blank and the computer will put in countdown: 30
If you want to have a different value, type in the words you want and put a ! where the seconds will go eg
This would look like this when the game runs:
When you click OK you will see the different attributes:
The next step is to add the Timer
I do this by going to Add > Timer and giving it a name:
Next I need to tell the computer to start on 30s and countdown in steps of 1.
I do this by clicking on Script typing in variable and choosing Set a variable or attribute:
I double click on the script to choose it and it looks like this:
I now CAREFULLY type in the name of my variable – player.countdown (Q5.3: game.pov.countdown)
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)
This basically tells the counter to countdown from 30 it steps of 1
Now I add in another script using IF to say what happens if the counter gets to 0
Next we need to tell the computer to start the timer when we go into the Dungeon.
Click on Dungeon then Scripts and find the After entering room section.
Add a script and search for Enable. Enable Timer1 to start:
Next we need to tell the computer to stop the time when the Dungeon.
Click in the Dungeon room and select scripts.
Find the After leaving room section and make up these scripts:
This tells the computer to stop the timer running, write a message and then “reset” it back to 30 when you leave the Dungeon
Run the game. When you go into the room, the timer starts automatically:
Here is the timer counting down some more
Here is the game finished when I did not get out in time
Here is when I get out of the room and go back to the other room – the timer resets to 30s
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!