Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Get Key State

The km.isdown([key]) command is used to read the state of any of the keyboard keys.

By replacing key with the number of any key, as defined in the Keys section, this command can be used for all keys.

Examples

Reading the A Key’s State

Input:

km.isdown(4)

Output:

km.isdown(4)
1            # The A Key in this case was pressed (1).
>>>

Reading the Left Control Key’s State

Input:

km.isdown(224)

Output:

km.isdown(224)
0            # The Left Control Key in this case was released (0).
>>>