-
Notifications
You must be signed in to change notification settings - Fork 15
Keycodes
Tony Wang edited this page Jun 10, 2019
·
2 revisions
These keycodes can be used with the KEY
or KEYP
functions to check input from keyboard. Pick any code according to your need.
Notice it doesn't count as uppercase or alternative character when holding both "shift" plus any letter, number, etc. it counts as for example, "left shift" + "1", "right shift" + "a", and so on.
' Helper function to shift some keycodes.
def to_keycode(k)
return bor(k, shl(1, 30))
enddef
CODE_RETURN = 13
CODE_ESC = 27
CODE_BACKSPACE = 8
CODE_TAB = 9
CODE_SPACE = asc(" ")
CODE_EXCLAIM = asc("!")
CODE_QUOTEDBL = 34
CODE_HASH = asc("#")
CODE_PERCENT = asc("%")
CODE_DOLLAR = asc("$")
CODE_AMPERSAND = asc("&")
CODE_QUOTE = asc("'")
CODE_LEFTPAREN = asc("(")
CODE_RIGHTPAREN = asc(")")
CODE_ASTERISK = asc("*")
CODE_PLUS = asc("+")
CODE_COMMA = asc(",")
CODE_MINUS = asc("-")
CODE_PERIOD = asc(".")
CODE_SLASH = asc("/")
CODE_0 = asc("0")
CODE_1 = asc("1")
CODE_2 = asc("2")
CODE_3 = asc("3")
CODE_4 = asc("4")
CODE_5 = asc("5")
CODE_6 = asc("6")
CODE_7 = asc("7")
CODE_8 = asc("8")
CODE_9 = asc("9")
CODE_COLON = asc(":")
CODE_SEMICOLON = asc(";")
CODE_LESS = asc("<")
CODE_EQUALS = asc("=")
CODE_GREATER = asc(">")
CODE_QUESTION = asc("?")
CODE_AT = asc("@")
CODE_LEFTBRACKET = asc("[")
CODE_BACKSLASH = asc("\")
CODE_RIGHTBRACKET = asc("]")
CODE_CARET = asc("^")
CODE_UNDERSCORE = asc("_")
CODE_BACKQUOTE = asc("`")
CODE_A = asc("a")
CODE_B = asc("b")
CODE_C = asc("c")
CODE_D = asc("d")
CODE_E = asc("e")
CODE_F = asc("f")
CODE_G = asc("g")
CODE_H = asc("h")
CODE_I = asc("i")
CODE_J = asc("j")
CODE_K = asc("k")
CODE_L = asc("l")
CODE_M = asc("m")
CODE_N = asc("n")
CODE_O = asc("o")
CODE_P = asc("p")
CODE_Q = asc("q")
CODE_R = asc("r")
CODE_S = asc("s")
CODE_T = asc("t")
CODE_U = asc("u")
CODE_V = asc("v")
CODE_W = asc("w")
CODE_X = asc("x")
CODE_Y = asc("y")
CODE_Z = asc("z")
CODE_F1 = to_keycode(58)
CODE_F2 = to_keycode(59)
CODE_F3 = to_keycode(60)
CODE_F4 = to_keycode(61)
CODE_F5 = to_keycode(62)
CODE_F6 = to_keycode(63)
CODE_F7 = to_keycode(64)
CODE_F8 = to_keycode(65)
CODE_F9 = to_keycode(66)
CODE_F10 = to_keycode(67)
CODE_F11 = to_keycode(68)
CODE_F12 = to_keycode(69)
CODE_INSERT = to_keycode(73)
CODE_HOME = to_keycode(74)
CODE_PAGEUP = to_keycode(75)
CODE_DELETE = 127
CODE_END = to_keycode(77)
CODE_PAGEDOWN = to_keycode(78)
CODE_RIGHT = to_keycode(79)
CODE_LEFT = to_keycode(80)
CODE_DOWN = to_keycode(81)
CODE_UP = to_keycode(82)
CODE_NUMLOCKCLEAR = to_keycode(83)
CODE_KP_DIVIDE = to_keycode(84)
CODE_KP_MULTIPLY = to_keycode(85)
CODE_KP_MINUS = to_keycode(86)
CODE_KP_PLUS = to_keycode(87)
CODE_KP_ENTER = to_keycode(88)
CODE_KP_1 = to_keycode(89)
CODE_KP_2 = to_keycode(90)
CODE_KP_3 = to_keycode(91)
CODE_KP_4 = to_keycode(92)
CODE_KP_5 = to_keycode(93)
CODE_KP_6 = to_keycode(94)
CODE_KP_7 = to_keycode(95)
CODE_KP_8 = to_keycode(96)
CODE_KP_9 = to_keycode(97)
CODE_KP_0 = to_keycode(98)
CODE_KP_PERIOD = to_keycode(99)
CODE_LCTRL = to_keycode(224)
CODE_LSHIFT = to_keycode(225)
CODE_LALT = to_keycode(226)
CODE_LGUI = to_keycode(227)
CODE_RCTRL = to_keycode(228)
CODE_RSHIFT = to_keycode(229)
CODE_RALT = to_keycode(230)
CODE_RGUI = to_keycode(231)
- Links
- Guides
- References
- Built-in examples
- Gist