Action: Letkey(variable, keystring)

Related Actions: letmousex, letmousey, letkeymap
Related Events: keypress, keyrelease
See also: FKiSS, Events, Actions

letkey(variable, keystring)

First defined in: FKiSS4
The letkey action sets the value of variable to the index of the first key in keystring which is pressed. Index starts at 1.
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. As soon as a specified key is seen as being pressed, no further processing is done.

Example:

; Watch for up arrow, down arrow, or "F".
; If up arrow is pressed, K = 1.
; If down arrow is pressed, K = 2.
; If "F" is pressed, K = 3.
; Otherwise, K = 0.
;@ letkey(K, "updownF")