Enum.KeyCode deprecations

All of the following Enum.KeyCode values will become deprecated:

QuotedDouble Hash Dollar Percent Ampersand LeftParenthesis RightParenthesis Asterisk Underscore Tilde Colon Plus Pipe LessThan GreaterThan Question At Caret LeftCurly RightCurly

These were previously impossible to get through InputService unless on OSX client or studio.

The proper way to detect for a “@” press is to check for
Enum.KeyCode.RightShift/Enum.KeyCode.LeftShift. is down, and . Enum.KeyCode.Two is down).

In addition, an upcoming update will fix OSX client/studio and Win Studio behaviours for these keys.

Finally, ingame chat and editable textboxes should work the same as before.

4 Likes

What if their keyboard has a different layout?

3 Likes

This method will cause an issue for European keyboard layouts. My keyboard has the @ key and " key switched from their positions on an American keyboard. Developers should probably just avoid trying to use these keys in general.

9 Likes

Most games specify shift-modified keybindings as “Shift+2” instead of “@” for clarity anyway. I think this is the best solution.

1 Like

Could we have some sort of function like “KeysLowerCase( Key)” or something that returns the key related to the character passed e.g. KeysLowerCase( “@” ) - Enum.KeyCode.2 or nil if there is none

So I’m currently in the middle of rewriting how windows/osx handles keyboard input. The general issue is you want to sometimes a) figure out what someone is typing and b) figure out what keys on the keyboard are pressed. These are not necessarily the same thing. Ideally for gameplay you would just want to be able to specify locations of keys for certain actions (ex: qwerty keyboard, when shift and 2 is pressed, do some action), and have it be the same location on all keyboards.

I just ordered a bunch of different keyboards with different layouts to make sure this will be the case, but generally plan on key codes being laid out in the US standard qwerty layout, and having those map to the same location physically on other keyboards. There will be a new InputObject type, called “TextInput”, that will contain a string of the thing the user has typed. Basically if you are holding shift + 2 on a US qwerty keyboard, TextInput will be the character @, but on a Irish qwerty keyboard you would get the character ".

10 Likes

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.