Syntax: function onKeyPressed(int keyCode, string keyName, int scanCode) { }


onKeyPressed is triggered when a key on the keyboard is pressed.
keyCode represents the pressed key as an ASCII/Unicode number.
keyName attempts to represent the pressed key with a string, but will obviously not succeed for keys like Ctrl or Shift.
scanCode is the number sent by the keyboard and is organized based on the position of the key on they keyboard. Results may differ if you use a very obscure keyboard.


function onKeyPressed(keyCode, keyName, scanCode)
  if (keyName == "f") echo("f was pressed");

... echoes "f was pressed" when the f key is pressed.



There is one comment on this page. [Display comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki