How to make Quest detect specific keyboard input. [SOLVED!]

Sebastian2203

In my game I have two links, one makes the player go left and other right.

I am very aware that after player travels 200 tiles it will get very annoying to use the mouse so what I need is a way to make the Quest recognize when I press the right arrow key and automatically click the link for me.

I could use this for other things, maybe I could access inventory with "I" and options with "ESC"..


Silver

You can already access inventory with I as standard.
But to answer your question (if I've understood it correctly) you need to learn how to make Commands.

http://docs.textadventures.co.uk/quest/tutorial/custom_commands.html


Sebastian2203

As far as I understand your answer, you are leading me to do it trough the command bar.

And that is what I want to avoid, I know that somewhere in the playercore.js of the Quest files there are event listeners that know to respond to a mouse click and that is what makes the links interactable.

I am sure it is possible to just set it to "listen" to keyboard instead.


Silver

Your questions are confusing :-/

But commands don't have to be typed in - you can make links trigger them also.

I should ask: are you using the CYOA editor or the Text Adventure one?


Sebastian2203

CYOA editor.

I apologize to you but I have always trouble with words when talking about my intentions on Quest,
maybe it has something to do with the fact that I am non-native English speaker who has self-taught the language.


Silver

I don't know the CYOA editor unfortunately.

I'd always suggest people use the Text Adventure editor and make the game look and act like a CYOA though as it gives you way more power under the hood.

Hopefully someone will be along to answer your specific CYOA queries.


Sebastian2203

Thanks for the advice.

Here is the game btw: http://play.textadventures.co.uk/Play.aspx?id=qp176u9xbumn4e3frhzekw

It is unfinished.
And as you can see, it is very sluggish to click the left/right buttons repeatedly.


Silver

Seems clever how you've made it do that!

There's some good coders here who may be able to help.

If done in the Text Adventure editor (which it isn't) my advice would be that clicking left would start a timer that would repeat the command. Although timers are min one second which is perhaps too slow.


The Pixie

The text adventure editor does come with a built in compass.

If you want it responsive, you need to do it all in JavaScript, what makes it slow is communicating with the server for each click. And you can do some good graphics; this is a game that did not get far at all, but click on "Stars and planets" and play with the star map.
http://textadventures.co.uk/games/view/ohqyc_lfuuiqjsuwmvbkbw/star-empire-v0-1

It is not trivial, but there is some guidance here:
https://github.com/ThePix/quest/wiki/Images-Part-02:-Creating-images-on-the-fly


Silver

I think the problem is they want the turn based system to become more real time (hence me mentioning timers)

The example game isn't IF. It's graphical (on a basic level)


Silver

Jay is the only person to make a real time game in Quest afaik .. (didn't he make a breakout type game with blocks and a ball or am I misremembering?)


DarkLizerd

I think, what Sebastian2203 wants is something more like a graphic adventure...
IE: screen map with the player icon in the middle...
player (user) hits the left arrow key and the player moves left 1 space.
player hits the up arrow key and the player moves up one space.
player hits the "A" key (for attack) and attacks the Orc in front of him...
1 key input... not "N" (for north) then enter... (2 key input)

Right?


DarkLizerd

Silver... not real time, but still turn based... Like Ultima,
1 key press, 1 action...
Altho, without the timer, I would suspect the break out game would be the same...


hegemonkhan

I think Jay (and maybe Pixie too) knows how to 'hook' keyboard keys with quest (I just searched using 'hook'):

http://textadventures.co.uk/forum/quest/topic/3847/how-can-i-impliment-an-image-based-health#25765


Sebastian2203

Thanks everybody!

http://play.textadventures.co.uk/Play.aspx?id=qp176u9xbumn4e3frhzekw

I did it.
You can now press left arrow key to move left and right arrow key to move right.

(I used Jay´s javascript glue.)


Sebastian2203

Pixie, at your wiki which you posted here, you use the link: http://www.w3schools.com/svg/
Which doesn´t work.


DarkLizerd

Got a download link... the on line version is slower than an Apple Mac running a Vic-20 emulator, emulating a Commodore Plus 4...
(Slow!)
:)
When I push a button, I expect action, not delay...
(No despite how it sounds, I am not complaining, altho it sounds that way...)
Glad you got it working, I may want to do something like this my self...
and I may have an idea on how to speed this up if it is the program that's causing the delay and not my satellite internet connection.


Log in to post a reply.

Support

Forums