How do I use scancodes?

From OHRRPGCE-Wiki
Jump to: navigation, search

Used by the plotscripting command 'key is pressed (key)', scancodes represent keys on the the keyboard. Each key has its own scancode, though there may be multiple symbols on the key.

Either, you use the command the hard way and look up keyispressed in the Plotscripting dictionary to find out what number each key is represented by, or (highly recommended) you can use the lists of scancode constants in scancode.hsi. scancode.hsi is automatically included, so there is no need to do anything to use it.

Then just use the name of the key with 'key:' affixed before it. Examples:

if (key is pressed (key: z)) then (...)
if (key is pressed (key: 3)) then (...)
if (key is pressed (key: enter)) then (...)
if (key is pressed (key: backspace)) then (...)

Please be aware that 'wait for key (type)' does NOT use scancodes, and therefore you can't use constants from scancode.hsi.

See Also[edit]