In order to represent key codes simply and efficiently, there is a special syntax for key codes, also known as action codes. Here are a few examples:

	<ENTER>    <CTRL ENTER>     <4>     <SHIFT A>     
	<"$">      <CTRL ALT F1>    <-4>    <A>

Key codes are often useful inside input handler scripts that are called directly by the interpreter (such as the menu handler that is specified with the menu function). A positive key code denotes that a key has been pressed. A negative one denotes the key has been released. (The plus or minus symbol can appear inside the code, as in <-PGUP> or <+PGUP>).

Key code identifiers are separate from the game's namespace, so there is no threat of conflict when declaring other identifiers that share the same name as a key code.

Mouse Buttons

	<LBUTTON>
	<MBUTTON>
	<RBUTTON>

Key codes are used to represent mouse buttons as well as keyboard keys, and in fact, there is no distinction in AGAST between a mouse button and a keyboard key. If you would rather use a numeric scheme to address your mouse, the left mouse button is also <BUTTON1>, middle <BUTTON2>, and right <BUTTON3>.

Mouse Wheel

>pre> <MOUSEWHEEL> <-MOUSEWHEEL> <MOUSEWHEEL>, or <+MOUSEWHEEL> means roll up, <-MOUSEWHEEL> means roll down. You can also abbreviate it to just <WHEEL>.

Digits (not on the keypad)

	<0> to <9>

Use a letter or digit to represent its keyboard key. To specify an uppercase letter, you must use the shift keyword as in <SHIFT A>, or enclose the letter in double-quotes (<"A"> or <"a">).

Named Keys

	<BACKSPACE>      <TAB>          <PAUSE>
	<SPACE>          <PGUP>         <PGDN>
	<END>            <HOME>         <LEFT>
	<UP>             <RIGHT>        <DOWN>
	<INS>            <DEL>          <ESC>

These keys are all found west of the number pad.

Function Keys

	<F1> to <F24>

These represent the functions keys. Of course, very few keyboards support 13 through 24.

Numeric Keypad

	<NUMPAD0> to <NUMPAD9>
	<MULTIPLY>
	<ADD>
	<SUBTRACT>
	<DECIMAL>
	<DIVIDE>

These keys are all found on the number pad. Except for <NUMPAD5>, all these keys are duplicated somewhere else on the keyboard. However, to use both sets of arrow keys, for example, you will have to test both key codes (i.e. <NUMPAD4> and <LEFT>).

Symbols

To use the symbol keys such as colon, percent, or tilde, you have to enclose the symbol in double quotes: <":">, <"%">, <"~">. To use a backslash or double quote, you will have to escape it with a extra backslash: <"\\">, <"\"">.

Special Key-Codes

	<DRAW>

One key-code does not represent a key at all, but a menu action. The interpreter sends a <DRAW> code to an installed menu handler to tell it to redraw the menu. It should do this using the built-in drawing functions.

See Also...