Hold.key

From AGI Wiki
Jump to navigationJump to search

The hold.key command sets the ego control keys to hold mode.

Syntax

hold.key();

Remarks

By default, when AGI starts, pressing and releasing a direction key starts ego moving. Ego will continue moving until a different direction key, or the 'stop' key ('5' on the numeric keyboard) is pressed.

The hold.key command changes this behavior such that while is direction key is pressed, ego will move in that direction. As soon as the key is released, ego will stop. The player must hold the key down for ego to keep moving.

Use the release.key command to restore normal behavior.

Possible Errors

Although the hold.key command was available beginning in version 2.911, the release.key command was not added until version 3.002.098. This means that if you use the hold.key command in an earlier version, you will not be able to go back to the default behavior for ego direction keys.

Example

Code:

<syntaxhighlight lang="agi"> hold.key(); [ sets key behavior to hold mode ... release.key(); [ resets key behavior to normal </syntaxhighlight>

Technical Information

Required Interpreter Version: Available in version 2.915 and above.
Byte-Code Value: 173 (0xAD hex)

See Also

Player Input Commands
release.key