First defined in: FKiSS4
The letkeymap action sets each bit in variable if the
corresponding key in keystring is pressed.
If no key in keystring is pressed, variable is set to
0.
variable
variable must be a variable name.
keystring
keystring must be a string identifying one or
more keys. The string is composed of one or more of the following
sub-strings concatenated together (All other keys are ignored):
- "up" (up arrow)
- "down" (down arrow)
- "left" (left arrow)
- "right" (right arrow)
- "space" (space bar)
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
- "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"
keystring is case-insensitive.
keystring is processed in order from left to right. Each
key specified corresponds to a single bit starting with bit 0. So if
three keys are specified in keystring, for example, "ABC", a
maximum of three bits might be set. For the example "ABC", bit 0 is set
if "A" is pressed, bit 1 is set if "B" is pressed, and bit 2 is set if "C"
is pressed. If you specify "CAB", then bit 0 is set if "C" is pressed,
bit 1 is set if "A" is pressed, and bit 2 is set if "B" is pressed.
The value that is stored in
variable is the sum of all the bits
set, where each bit is a power of 2. The following table shows the powers of 2:
Bit | Value | Bit | Value |
---|
0 | 1 | 1 | 2 |
2 | 4 | 3 | 8 |
4 | 16 | 5 | 32 |
6 | 64 | 7 | 128 |
8 | 256 | 9 | 512 |
10 | 1024 | 11 | 2048 |
12 | 4096 | 13 | 8192 |
14 | 16384 | 15 | 32768 |
16 | 65536 | 17 | 131072 |
18 | 262144 | 19 | 524288 |
20 | 1048576 | 21 | 2097152 |
22 | 4194304 | 23 | 8388608 |
24 | 16777216 | 25 | 33554432 |
26 | 67108864 | 27 | 134217728 |
28 | 268435456 | 29 | 536870912 |
30 | 1073741824 | 31 | -2147483648 |
It is recommended the cursor keys and space bar strings be put at the
beginning of keystring in lowercase, and all single letters after
that in uppercase followed by the digits. For example, "updownspaceABC0123".
A maximum of 32 keys can be tracked in one keystring.
|
Example:
; Watch for up arrow, down arrow, and "F".
; If only F is pressed, K = 4 (bit 2 is set; 2 raised to the power of 2 is 4).
; If up arrow and F are pressed, K = 5 (bit 2 and bit 0 are set: 2 to the power of 2 (4) plus 2 to the power of 0 (1) is 5).
;@ letkeymap(K, "updownF")