The online racing simulator
Question for /key command with arrow buttons
Hey there,

came across an issue with the /key command (or at least i cant figure it out).

For my Driving Assistant, i sometimes need to set the braking key of the user to the "down" arrow for example.

How in the world to i set that via the /key command haha?

/key down brake does not work... And i have tried almost every possible other way of spelling it, but i cant get it to work.

/press command works with key "down", and the /key command works like /key m brake, to set the brake key to m...

But setting the brake key to one of the arrow keys... I cant figure out how.
Any tips?

Best regards,
Robert
I'm not sure, but I do know that arrow keys, shift, alt, ctrl, tab and such have a special way of usage, since they don't have an asci character representation.
Quote from rane_nbg :I'm not sure, but I do know that arrow keys, shift, alt, ctrl, tab and such have a special way of usage, since they don't have an asci character representation.

Yeah, I am aware of that, but since other commands support "up", "down", "left", "right", my best guess was that it would be the same for the /key command, which either it isn't, or I am just not clever enough to figure it out haha.
Quote from Rob2003 :Yeah, I am aware of that, but since other commands support "up", "down", "left", "right", my best guess was that it would be the same for the /key command, which either it isn't, or I am just not clever enough to figure it out haha.

I've been playing around with it and i haven't been able to figure it out either.
Its likely that there was just never implemented any support for it.

Even after reading through the entire documentation for LFS Commands (host and local), there are no indications that it is possible.

It even says at the bottom of the page of LFS Manual:

Quote :Parameters for the key commands (press / shift / ctrl / alt)

Letters A to Z
Numbers 0 to 9
F1 to F12
up, down, left, right
space, enter, esc, tab
less, more, minus, plus

Is there a reason why you specifically need to use the arrow keys? Isn't there another way around it?
The /key command can only take a single character.

To be complete it should really accept all the legally assignable keys.

KBA_MOUSE_L,
KBA_MOUSE_R,
KBA_MOUSE_M,
KBA_WHEEL_U,
KBA_WHEEL_D,
' '
'0' to '9'
'A' to 'Z'
KD_UP
KD_DOWN
KD_RIGHT
KD_LEFT
KD_PGUP
KD_PGDN

(minus some reserved keys... don't worry about the strange names, internal constants)

I've made a note to look if this can be enabled in the next day or two but there are higher priorities still.
Quote from Scawen :The /key command can only take a single character.

To be complete it should really accept all the legally assignable keys.

(...)

(minus some reserved keys... don't worry about the strange names, internal constants)

I've made a note to look if this can be enabled in the next day or two but there are higher priorities still.

Yeah, that would be awesome. And yes, sure, I know it is not a high priority thing Wink!
Quote from kristofferandersen :I've been playing around with it and i haven't been able to figure it out either.

(...)

Is there a reason why you specifically need to use the arrow keys? Isn't there another way around it?

Well thanks for trying anyway! Smile If this is added with one of the next updates, the question is not relevant anymore, but in case you are interested - or bored, idk haha -, i still wrote my reason behind the question haha:

The reason I have to use the arrow keys is that some users of my program are for sure going to be using arrow keys (and i do too when testing the program with keyboard - i typically use a wheel for normal playing).

In the new version, I am trying to improve the emergency braking interventions, which work good for wheel/controller users, but are a little hit and miss for mouse and keyboard users, as I didn't pay too much attention to that up until now. The problem is mainly that if I release a button in my code, let's say the "S" key, when a user uses WSAD for driving, i cannot (or at least i didn't find an elegant way to so) find out if the user is still pressing the key, since the latest event is a KeyUp Event that my program sent. And while i override the users keyboard, i am not really able to keep track of whether he is releasing the "S" button, since my program is still overriding "S" and it is pressed all the time, as i cant really distinguish between real or synthetic keyboard events the way that i generate them.

That's why I thought that I might be able to implement a similar logic to the Wheel/Controller emergency braking. That way I can change the assigned button in LFS quickly while the braking intervention is in progress and reset it afterwards (which works really reliable for Controller/Wheel for years now). That way i can easily keep track of the users actual inputs on the brake key, as i am overriding a spare key of some sort.

I hope that makes sense (even though it was unnecessary to explain all of that haha). That was my reason behind the question.

FGED GREDG RDFGDR GSFDG