Set.key

From AGI Wiki
Revision as of 12:39, 21 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''set.key''' command assigns a keyboard shortcut to a controller. == Syntax == set.key(byt ASCII, byt SCAN, ctl cCTRL); == Remark...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The set.key command assigns a keyboard shortcut to a controller.

Syntax

set.key(byt ASCII, byt SCAN, ctl cCTRL);

Remarks

The key combination derived from ASCII and SCAN codes are assigned to controller cCTRL. To assign an ASCII key press to a controller, the SCAN value should be zero. To assign a SCAN code key press, the ASCII value should be zero.

For a list of usable ASCII and SCAN code values that can be assigned, see the Setting Up Keyboard Shortcuts topic.

Possible Errors

If an invalid combination of ASCII and SCAN is used, AGI will assign the controller, but it will just take up space in the controller assignment table and not do anything.

Similarly, if you use an invalid controller value, you will waste a space in the controller assignment table.

Example

Code:

<syntaxhighlight lang="agi"> set.key(0, 59, c1); [ F1 to controller 1 set.key(9, 0, c2); [ Tab key to controller 2 </syntaxhighlight>

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 121 (0x79 hex)

See Also

Player Input Commands