Usage
Syntax: function onKeyPressed(int keyCode, string keyName, int scanCode) { }
Explanation
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.
Example
function onKeyPressed(keyCode, keyName, scanCode) { if (keyName == "f") echo("f was pressed"); }
... echoes "f was pressed" when the f key is pressed.
Categories
CategoryFunctionEvent