Event: Keypress(keyname)

Related Events: keyrelease
Related Actions: letkey, letkeymap
See also: FKiSS, Events, Actions

keypress(keyname)

First defined in: FKiSS4
The keypress event is triggered when the user presses the corresponding key on the keyboard.
Only one keypress event should exist for any keyname.

keyname

keyname must be a string identifying a single key. The string can be one of the following:
  • "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.

Example:

;@ keypress("up")    ; If the up arrow is pressed,
;@   move(#1, 0, -5) ; move object # 1 up 5 pixels.
;@ keypress("h")     ; If the "H" is pressed,
;@   map("help.cel") ; show the "help.cel" image.