OnKey Command

Specifies a special subroutine call to the specified label if the user presses the key specified by key-value.

Syntax

OnKey key-value [GoSub label]

where

key-value Specifies key value defined by the Adv_Keys command.
label Specifies the label defined by the Label command.

Remarks

If label is not specified, any current OnKey command for the key specified by key-value is cleared. If a key is intercepted by OnKey, it does not count as a key press for the Wait command; and, if no Adv_Keys list is in effect, the key is not passed to Flight Simulator.

Note: You can only use the OnKey command with keys specified by Adv_Keys.

Example

ADV_KEYS ADD, KV(CTRL “r”) 'Restart adventure.

ADV_KEYS ADD, KV(CTRL “u”)'Quit, bail out of adventure.

ONKEY KV(CTRL "r") GOSUB subMKeys_r

ONKEY KV(CTRL "u") GOSUB subMKeys_u

subMKeys_r:

PRINT "Restarting the current adventure."

RESET_ADVENTURE

RETURN

subMKeys_u:

GOTO MAIN_END

RETURN

MAIN_END:

END