View Single Post
  #4  
Old 06-27-2006, 08:16 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
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.
__________________
Do it with a DON!
Reply With Quote