COUNTING TIMER Question...

delorianhayze
24 Aug 2007, 04:18
Hey all, thanks for your potential help!
In my game there is a chase sequence through a maze. I alert the player that they have 2 minutes to get through the maze. Once the 2 minutes is up, the place explodes and the player loses.

My question is...
How do I do the following (if it's even possible)
1.) Print a message every 10 seconds saying how much time is left.
2.) Create a 2 minute counter that the player can watch tick down. So far my best guess is an animated gif with 1 second intervals.

Please help!
Thanks!
Delorian

witch wyzwurd
24 Aug 2007, 09:29
Hey Del (if I may),

No gifs are need. Quest has a built-in Status Variable which can be used to display time. I can help you display it in seconds. Follow the instructions below...

...none of the instructions use the "tree-panel" in QDK... my instructions refer to the "text links" in QDK's upper-bar...

01. Click "Game"
02. Click "Status Variables"
03. Click "Add"
04. Name your Status Variable
05. Keep "Type" radial button set at "Numeric"
06. Type "120" in "Initial Value" text-box
07. Type "! Second*s* remain." in "Display" text-box
08. Click "OK"
09. Click "OK"
10. Click "Game"
11. Click "Timers"
12. Click "Add"
13. Name your Timer
14. Click "OK"
15. Type "1" in the "Interval (secs)" text-box
16. Click "Edit"
17. Open "Variables" in left-side menu
18. Click "Decrement a Numeric Variable"
19. Fill in your Status Variable name in the "Numeric Variable Name" text-box
20. Click "OK"
21. Click "OK"
22. Click "OK"

That sets up your Status Variable to start at 120 seconds and count down by 1 second intervals... it'll keep going into negative infinity, so next I'll show you how to stop it at 0 seconds and produce a script... by the way, the "!" symbolizes "whatever value" and "*s*" tells Quest that to only include an "s" when the word should be pluralized... continuing on...

23. Click "Game"
24. Click "Status Variables"
25. Select your Status Variable
26. Click "Edit"
27. Click "Edit"
28. Click "Add Conditional" button
29. Click "Add" for "If" row
30. Select "Compare two strings, values or properties" from list
31. Click "Percent; Insert Numeric Variable" button for "String 1" within the "Condition Parameters" column
32. Select your Status Variable
33. Click "Insert"
34. Select "Equal to" for "Comparison"
35. Type "0" (that's a zero) in "String 2" text-box
36. Click "OK"
37. Click "Edit" for "Then" row
38. Open "Timers" in left-side menu
39. Click "Turn Off a Timer"
40. Fill in your Timer name in the "Timer Name" text-box (+++)
41. Click "OK"
42. Click "OK"
43. Click "OK"
44. Click "OK"

Now when your Status Variable reaches "0," your timer stops counting, which, in turn, halts your Status Variable at "0 seconds remain." If you don't want to display your Status Variable when "0 second remain.," then check the "Don't display when value is zero" box within your Status Variable edit screen; this will cause your Status Variable to disappear...

...To end the game, simply add in some commands after (+++), like a message and "Finish the game by making player lose" which is found in "Game Controls" in the left-side menu...

... Now it's not necessary to display a message saying how much time is left, since the player is watching their life pass before their very eyes.

Reason your way through figuring out how to start the timer and status variable when you want it to start... that should be fairly easy now. And, oh yah, within the Timers edit screen, there's a check-box for "Initially timer is on." Check that if you want the timer to be on from the start of the game, and the opposite if you don't.

delorianhayze
24 Aug 2007, 13:52
WOW, above and beyond! Thanks so much! I'll try it out today!
Thanks again, really appreciate it!

Delorian
(Del is fine)

delorianhayze
24 Aug 2007, 14:40
For whatever reason I get...

"Run-time error '35601':
Element not found

When I use this method. Meaning, I inputted everything you asked me to do. Then when the player starts the level, I set my timer to On. But when it gets to that part in the game it displays this message. Any idea why?

Thanks again!
Delorian

Elexxorine
24 Aug 2007, 15:16
Ok, open notepad and open your game file with notepad. You'll see some code, copy this and paste it here, and I can see what is wrong with it. Most likely it's you've spelt the name of something wrong when trying to use it ,so double check those, if you can't see what's wrong, give me the code and I can check over it for you and give you the fixed version.

delorianhayze
24 Aug 2007, 15:24
Thanks you were right. I mispelled something. Everything works fine now.
I have one final question that I'm sure is quite simple.

I want the "120 seconds remaining" to be shown at a later part of the game (when it actually applies)
Right now this is displayed at the very beginning of the game, and I only want it to be displayed later, when the counter actually ticks down.

Thanks so much as always!
Delorian

Elexxorine
24 Aug 2007, 15:26
Have it set to '0' initially, and click the bit that means it doesn't display when it's at zero (in the variable set-up). Also have the timer set to off at eh beginning. when it comes to the time you need the counter, set it to '120' and turn the timer on. If you need more detailed instructions, I can do that...

delorianhayze
24 Aug 2007, 15:40
Worked like a charm. Can't thank you guys enough!

Many Thanks,
Delorian