View Single Post
  #3  
Old 06-27-2006, 06:52 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
In v4 the old scripting engine is providing the scancode too.

Keycode - the virtual keycode, you can search for VK_ESCAPE (or XK_) or similar on the web. That works also for special keys, like Escape, Shift etc. You can get the keycode for a special character with the function getkeycode(character). Also the function keydown2(keycode,ignoremodifierkeys) requires keycodes.

Keystring - the character pressed, e.g. 'a'

Scancode - the number of the key on the keyboard. This is different on Mac (USB keyboards?) and Windows/Linux, but it's the only way to detect some keys that are used for several characters at the same time. This has been added in v4 to make things like Piano simplier. You need to test this on Mac though since the scancodes are different there (check player.platform). Best might be in this case to let the player choose the keys he/she wants to use, although that will require some scripting to ask the player to press the wanted key and then check in onKeyDown what scancode the key has.
Reply With Quote