What are the differences between the "wait for key" command and the "wait for scancode" command?

From OHRRPGCE-Wiki

Jump to: navigation, search

Contents

[edit] wait for key

The wait for key command waits for the player to press a key. It stops the script until the key is pressed. No value is returned.

The "wait for key" command use the following constants: upkey, downkey, leftkey, rightkey, usekey, cancelkey, menukey, anykey.

Please note that:

  • The two sets of constants are not interchangable. You can't use "upkey" instead of "key:up" with the "wait for key" command.
  • "use key" means SPACE or ENTER or CTRL or joystick button 1, "cancel key" means ALT or ESC or joystick button 2, "menu key" is the same as "cancel key".
  • Writing "wait for key" without any brackets is the same as writting "wait for key (any key)" (The argument defaults to anykey)

[edit] Wait for scancode

For those who could have forgot about scancodes,the scancodes represent keys on the the keyboard. Each key has its own scancode, though there may be multiple symbols on the key. They are stored in your hsi file but to make make to use them in your hs file, you have to add the line "include, scancode.hsi"

include, scancode.hsi

Now about the command itself. Waits for scancode is a command that make the player waits to press a specific key. The specific key in question will be a constant already used by the command key is pressed

show text box(314) # "press F!"
wait for scancode(key:F)


[edit] To conclude

The difference is what they take. wait for key takes a parameter like use key or any key, where wait for scancode takes something from scancode.hsi (such as key:a). In both situation, the game will wait until the specified key is pressed. So we can conclude that the 2 commands are slightly difference and can be useful in the same kind of situation.

If you still have doubts and you if you don't which one you have to use, feel free to post a message one of the forums of the community!

[edit] See Also

Personal tools