onKeyDown() and onKeyUp() are basically the same as onKeyPressed() but instead works if you press a key while the control you use it with has focus (of course onKeyUp() is the same as onKeyDown() but is triggered when you release the key). The keycode is basically the number assignment for the key you press down.
An easy way to check for the keycode in an online script:
NPC Code:
function onKeyPressed(keycode, keystring, scancode) {
echo("---");
echo("Keycode: " @ keycode);
echo("Keystring: " @ keystring);
echo("Scancode: " @ scancode);
}
This of course will show you the keycode, key letter and scancode in question being pressed.
Keystring is just the label of the key that you press but it doesn't always work (It only works for character keys such as letters, numbers and other charcters like : [ , . ' / ~). It will just be blank for keys such as shift or page down.
Scancode I haven't really worked with much. Can't help you with that sorry.