How to recognize what keys are pressed.

I am making a game in text adventure mode, not gamebook mode. I am not using hyperlinks. I want to present the player with two options. The player presses 1 or 2 to choose between the options. How can Quest recognize what keys are pressed? Is there a way to use the if script to do this? Thanks.


Yes... But I wish it was as easy as the Basic command Inkey$... but anyway...
http://textadventures.co.uk/forum/games/topic/1xcgxubq2kqy_ckx7hm9jq/space-invaders-v0-03-now-real-time
uses .js code to read a keypress from the keyboard.

There is also a script called HookKeyTest.aslx that reads the keyboard and returns the key pressed...
(But I can't find the posting that I got the code from... )
Look, search, best guess, the assorted postings across the forum and you may find that other people have already solved the problem you have...


Also look at ShowMenu, which is a different approach to what DarkLizerd is discussing, but maybe what you want (and is way easier).


if you specifically want specific keys to activate stuff, that requires 'hooking' and seems to deal with using JS (non-quest means) to do it. I'm not sure if this 'hooking' is still tied to quest's command/input bar (being highlighted / typed into) or not.

if you just want to have to press a single key (a single character/symbol input), then there's the command/input bar, and you can use the 'Command' Element or 'get input Script/Function, to get that

if you don't mind clicking, then you can just use the hyperlinks (using the command-text-processor's command scripting/syntax commands and/or inline Functions/Scripts like Pixie's example of 'ShowMenu' Function/Script, any such Function's/Script's that do inline-hypertexting will have capitolized letters: ShowMenu, Ask, etc, whereas their popup window menus versions use non-capiltolized letters: show menu, ask, etc etc etc), and/or you can use the buttons on the right side (via Verbs).

and as mentioned above, there's also the popup window menus, if you don't mind them and clicking on their choices/items, and then you handle them of course in rest of code/scripting.


and that's all the ways to interact, as far as I'm aware of and/or remembering (lol) ...


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

Support

Forums