Key values (such as the key argument of the OnKey command or the value of the Key variable) are integer values that represent the internal value of keys. This topic explains how these values can be used in APL.
In APL, the KV( ) function is used to represent key values. The KV( ) function is different from other functions because its argument is not a normal expression; instead, the argument for the KV( ) function is a combination of special keywords and can include a quoted string.
The argument for the KV( ) function can start with any or all of the keywords included in the following table.
Keyword | Indicates |
ALT | ALT key pressed. |
CTRL | CTRL key pressed. |
SHIFT | SHIFT key pressed. |
The actual key can be specified as either an ASCII character enclosed in quotation marks or specific non-ASCII keys identified by name. If an ASCII character enclosed in quotation marks is used, the character indicates both the key and the SHIFT status.
The key names that the KV( ) function recognizes are included in the following table.
Key Name | Keyboard locale |
KeyPad0–KeyPad9 | Numeric keypad keys. |
KeyPadPeriod | Numeric keypad period (.), or DEL, key. |
F1–F12 | Function keys. |
For example, KV(CTRL KeyPad9) specifies CTRL+PgUp, KV(SHIFT “Q”) specifies SHIFT+Q, and KV(CTRL ALT F1) specifies ALT+CTRL+F1.
Note: Except for internal testing, adventure programs should never explicitly use internal key values.