KEYBOARDVALUE
Outputs a number that corresponds to last key that was either pushed or released. The number which it outputs depends on both the key that was pressed and whether KEYBOARDON was given one or two inputs.
If KEYBOARDON was given one input, then the keyboard input is captured as the character that was typed.
That is, KEYBOARDVALUE outputs the ASCII value of last character that was typed.
For example, on a US keyboard, "5" and "%" are both painted on the same key.
If user hits the '5' key without a Shift, then KEYBOARDVALUE outputs 53
, which is ASCII 5
.
On the other hand, if the user hits the '5' key while holding the Shift key down, then KEYBOARDVALUE outputs 37
, which is ASCII "%
.
Furthermore, if KEYBOARDON was only given one input, then keystrokes that are not directly related to textual characters are ignored. For example, the Shift, Ctrl, Home, and End keys are ignored.
If KEYBOARDON was given two inputs, then KEYBOARDVALUE outputs the keystrokes as distinct physcial keys on the keyboard, but not necessarily the intended character.
In this case, when the 5 key is pressed, KEYBOARDVALUE outputs the same number regardless of whether Shift was being held at the time.
However, there are distinct events when the Shift key is pressed and when it is released, so you can still identify the difference between a 5
and a %
.
In general, if KEYBOARDON was given two inputs, then each physical key generates a unique number, but there are exceptions.
The number that is assigned to some keys may vary across keyboards and keyboard layouts (for example, US or French).
Similarly, some keyboards (such as the Microsoft Natural Keyboard or the Microsoft Comfort Keyboard) have more keys than a normal keyboard and can generate keyboard events that cannot be generated on other keyboards (such as a "Left Shift" as distict from a "Right Shift", or a "Volume Up" key).
Finally, some small keyboards, such as those on a laptop, have special modes where the same physical key might act as two distinct keys depending on the keyboard's mode.
For example, the J
key might act as a Num Pad 1
when a special "alternate mode" key is held down.
The KEYBOARDVALUE assignments shown in the table below should be portable across all keyboards.
Key | KEYBOARDVALUE |
---|---|
Backspace | 8 |
Tab | 9 |
Clear | 12 |
Enter | 13 |
Shift | 16 |
Ctrl | 17 |
Alt | 18 |
Pause | 19 |
Caps Lock | 20 |
Esc | 27 |
Spacebar | 32 |
Page Up | 33 |
Page Down | 34 |
End | 35 |
Home | 36 |
Left Arrow | 37 |
Up Arrow | 38 |
Right Arrow | 39 |
Down Arrow | 40 |
Print Screen | 44 |
Insert | 45 |
Delete | 46 |
0 Key | 48 |
1 Key | 49 |
2 Key | 50 |
3 Key | 51 |
4 Key | 52 |
5 Key | 53 |
6 Key | 54 |
7 Key | 55 |
8 Key | 56 |
9 Key | 57 |
A Key | 65 |
B Key | 66 |
C Key | 67 |
D Key | 68 |
E Key | 69 |
F Key | 70 |
G Key | 71 |
H Key | 72 |
I Key | 73 |
J Key | 74 |
K Key | 75 |
L Key | 76 |
M Key | 77 |
N Key | 78 |
O Key | 79 |
P Key | 80 |
Q Key | 81 |
R Key | 82 |
S Key | 83 |
T Key | 84 |
U Key | 85 |
V Key | 86 |
W Key | 87 |
X Key | 88 |
Y Key | 89 |
Z Key | 90 |
Left Windows Key | 91 |
Right Windows Key | 92 |
Applications Key | 93 |
0 Key on Num Pad | 96 |
1 Key on Num Pad | 97 |
2 Key on Num Pad | 98 |
3 Key on Num Pad | 99 |
4 Key on Num Pad | 100 |
5 Key on Num Pad | 101 |
6 Key on Num Pad | 102 |
7 Key on Num Pad | 103 |
8 Key on Num Pad | 104 |
9 Key on Num Pad | 105 |
* Key on Num Pad | 106 |
+ Key on Num Pad | 107 |
- Key on Num Pad | 109 |
. Key on Num Pad (decimal separator) | 110 |
/ Key on Num Pad | 111 |
F1 | 112 |
F2 | 113 |
F3 | 114 |
F4 | 115 |
F5 | 116 |
F6 | 117 |
F7 | 118 |
F8 | 119 |
F9 | 120 |
F10 | 121 |
F11 | 122 |
F12 | 123 |
Num Lock | 144 |
Scroll Lock | 145 |
Volume Mute | 173 |
Volume Down | 174 |
Volume Up | 175 |
+ Key | 187 |
, Key | 188 |
- Key | 189 |
. Key | 190 |
The following KEYBOARDVALUE assignments should be portable across all keyboards with a standard US layout.
Key | KEYBOARDVALUE |
---|---|
; or : | 186 |
/ or ? | 191 |
` or ~ | 192 |
[ or { | 219 |
\ or | | 220 |
} or ] | 221 |
' or " | 222 |
KEYBOARDON [PRINT CHAR KEYBOARDVALUE] FULLSCREEN SETFOCUS [FMSLogo]
Press the 'A' key on the keyboard
aPress the 'B' key on the keyboard
bKEYBOARDOFF SPLITSCREEN