Login
Remember
IF Answers
Ask a Question

# Stopping timer Event with Key Press

0 votes
100 views
asked Jul 8 in Authoring by Grids (1 point)
edited Jul 9 by Alex

Hi,

I new to Quest (but really enjoying it). I would like to create really, really simple combat (much simpler than the kit). By having a turn event (with a timer) when you enter a room (e.g. 'Cyborg attacks you' - if this happens 3 times with one monster you die) and having a key press (e.g. press 'Enter' or 'x') to stop this.

I am having trouble finding how to do a key press to stop a timer event. Actually to be honest I don't know how to do a key press to do anything. I would also like to have key presses with sounds assigned to different keys in different rooms to trigger sounds.

I am hopeless with anything coding related - is there a simple way to do this. I assume there is but I just am having trouble finding it. Thanks for your help.

- key
- quest
- timer
- turn-script

## 1 Answer

0 votes
answered Jul 10 by hegemonkhan (161 points)
edited Jul 11 by hegemonkhan

there's only two ways of using player input (during game play) via the command~text box at the bottom of screen:

.1. the 'get input' Script:

(Elements: GUI~Editors' Verbs ~ Object's Script Attributes, Functions, Commands, Turnscripts, Timers, etc) -> run as~a script -> ouput -> 'get input' Script

http://docs.textadventures.co.uk/quest/elements/

.2. the 'Command' Element ( http://docs.textadventures.co.uk/quest/elements/command.html )

right click on the specific room(s) that you want where the 'attack' occurs (this should also have the Timer~Turnscript added to them too) and select 'add Command'. This is known as 'local' usage, as they're tied to specific rooms, and not the entire game.

otherwise, if you want global Turnscripts~Timers~Commands, right click on the upper-left-most 'Objects' in the left side's 'tree of stuff, and 'add Timer~Turnscript~Command' to make them global (applying to the entire game, anywhere in the entire game, and not just only to specific rooms).

hopefully it is pretty self explanatory....

the 'pattern' text box, is what is required for the person playing the game to type in, to activate the Command. So here you can put in your 'x' (you'll have to type in the x in the command~text line box during actual game play, but that's pretty much the same as pressing the 'x' keyboard key, lol)*

*Jay (Jaynabonne) may know of a how to directly 'hook' the pressing of the 'x' key, if it is possible. So you can try asking him if its possible, and if it is, he can likely help you with it.

the 'scripts' adding is what will be a bit complex... due to the designs you mentioned.

if you're using a Timer or Turnscript for your 'attacks upon you', then the script for the Command would just be the 'disable Turnscript~Timer' Script.

however, if you want the 3 attacks design, that's going to take some more work, as you got to do the scripting and Attribute adding that is needed for it, both within your Turnscript~Timer and your Command.

try looking at this thread, as it's design method is similiar to what you need~want to do:

http://ifanswers.com/896/quest-having-trouble-with-turn-scripts

or the original source (though this is a bit different design wanted, but it's what used as the basis for the above link):

http://forum.textadventures.co.uk/viewtopic.php?f=10&t=5347#p37066

so, this link may confuse you worse.

commented Jul 11 by Grids (1 point)
Thanks for this. I'll look over the links and think it over a bit more. Appreciate the tips.

## Related questions

- Quest: Having trouble with Turn Scripts.
- Is there a limit to the length of a script in Quest?
- How can I check the user's command?
- Quest Problem with "Get Input" in a loop
- I need help with attributes.

...