Navigating player with keyboard

Hello everybody

Im sure this querstion been up beforte but I can not find anything so Im trying my luck here.

Is it possible to navigate the player between rooms with a simple keypress?

I have played around with it and the only sulotion I came up with is to use a script command. Like pressing "d" and enter to move right.


You should be able to do that with Javascript, but you'd have to be careful you didn't cause problems with other parts of the UI that might be processing keyboard input.

I'd suggest creating a small invisible div somewhere it won't be noticed (like next to the input field). Then give it a onkeyup handler. In the case of pressing an arrow that corresponds to a non-disabled compass button, send a click to the relevant compass button; for any other key, send the keypress event back to the command bar and move focus there (so once you've started typing a command, the arrow keys will move the cursor around within it normally).

Maybe there's a better way to do it, but this is the first one that comes to mind for me.


There is a program here that demonstrates the "one key move" idea...
HookKeyTest…
You will need to search for it, I don't remember where I found it...
It uses .JS to read the keyboard, then return a command back to the program...


Log in to post a reply.

Support

Forums