Keyboard

by Forum_account
A library for handling keyboard input.
ID:406984
 
The previous update made it possible to do things like this:

client
keys = list("a", "b", "c")

And the library would only define macros for the A, B, and C keys. Now, in version 4, you can specify the keys as a pipe-delimited string:

client
keys = "a|b|c"

You can still use the old method of specifying a list, if you'd like. The reason for using a text string is that lists aren't constant expressions. I wanted to add a way to have pre-set groups of keys so you can do this:

client
keys = LETTERS + NUMBERS

Which would cause the library to make macros only for A-Z and 0-9. To have this work, the LETTERS and NUMBERS vars have to be text strings, not lists. The library defines these constants you can use:

var
const
ARROWS = "|west|east|north|south|"
NUMPAD = "|west|east|north|south|northeast|southeast|northwest|southwest|center|"
EXTENDED = "|space|shift|ctrl|alt|escape|return|tab|back|delete|"
PUNCTUATION = "|`|-|=|\[|]|;|'|,|.|/|\\|"
FUNCTION = "|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|"
LETTERS = "|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|"
NUMBERS = "|0|1|2|3|4|5|6|7|8|9|"

ALL_KEYS = NUMPAD + EXTENDED + FUNCTION + LETTERS + NUMBERS + PUNCTUATION

The default value is ALL_KEYS.

I also made a change that fixes support for certain keys. OrangeWeapons pointed out that you couldn't macro the equals key. Now all keys should work.