Skip to content

$keymap

19 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

commit_remap

read-only
$keymap.commit_remap(user: User, keymap: Reference) -> bool

Write remapped controls data to persistence for a given user and keymap.

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap.

Returns bool: Whether successful.

get_aliases

$keymap.get_aliases(keymap: Reference) -> list

Get a list of all alias names (control names) of a given keymap.

ParameterTypeMeaning
keymapReferenceThe keymap.

Returns list: The list of alias names.

get_axis

read-only
$keymap.get_axis(user: User, keymap: Reference, alias: string, remap: bool, allow_fallback_input: bool, ignore_input_mode: bool) -> float

Get the value of an aliased axis.

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap used to determine aliased axis.
aliasstringThe name of the aliased axis in the given keymap.
remapboolWhether to consider keymap remapping data of the given user.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns float: Value between -1.0 and 1.0.

get_bindings

read-only
$keymap.get_bindings(user: User, keymap: Reference, alias: string, remap: bool) -> list

Get a list of all keys bound to a given keymap alias (control).

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap.
aliasstringThe name of the aliased input to search for in the given keymap.
remapboolWhether to consider keymap remapping data of the given user.

Returns list: The list of keys (vwm_key_t).

get_input_index_from_any_axis_input

read-only
$keymap.get_input_index_from_any_axis_input(axis_dead_zone: float) -> int

Check if any key has been pressed and return the index of the input method if so.

ParameterTypeMeaning
axis_dead_zonefloatThe dead zone value to use for the axes.

Returns int: The gamepad index of the first axis input; -1 if no valid axis input was found.

get_input_index_from_any_keypress

$keymap.get_input_index_from_any_keypress(include_special_characters: bool) -> int

Check if any key has been pressed and return the index of the input method if so.

ParameterTypeMeaning
include_special_charactersboolTrue if we should include special characters as valid input.

Returns int: The gamepad index of the key pressed; 0 if keyboard key was pressed; -1 if no valid press was found.

get_input_index_from_any_valid_joycon_style

read-only
$keymap.get_input_index_from_any_valid_joycon_style() -> int

Check if any input has a valid joycon sytle and return the index of the input method if so.

Returns int: The gamepad index of the first valid joycon style; -1 if no valid joycon input was found.

has_alias

$keymap.has_alias(keymap: Reference, alias: string) -> bool

Test if a given keymap has the specified alias defined.

ParameterTypeMeaning
keymapReferenceThe keymap to search within.
aliasstringThe name of the aliased input to search for in the given keymap.

Returns bool: True if the aliased key was found in the given keymap; otherwise false.

is_active

read-only
$keymap.is_active(user: User, keymap: Reference, allow_fallback_input: bool) -> bool

Check if a keymap is active based on the current input mode

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap to check.
allow_fallback_inputboolIf the connection is invalid, assume the keymap is active.

Returns bool: True if the keymap is active based on the current input mode.

is_any_axis_non_zero

read-only
$keymap.is_any_axis_non_zero(user: User, keymap: Reference, allow_fallback_input: bool, ignore_input_mode: bool) -> list

Determine if any axis within the specified keymap is non-zero.

ParameterTypeMeaning
userUserThe user handle
keymapReferenceThe keymap to perform the check on.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns list: List where [0] indicates if an axis was non-zero, [1] the alias of the _first_ non-zero axis detected, and [2] the value of that axis; or if no axis was non-zero [false, NULL, 0.0f]

is_any_key_pressed

read-only
$keymap.is_any_key_pressed(user: User, keymap: Reference, allow_fallback_input: bool, ignore_input_mode: bool) -> list

Determine if any key within the specified keymap is pressed.

ParameterTypeMeaning
userUserThe user handle
keymapReferenceThe keymap to perform the check on.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns list: List where [0] indicates if a key was pressed and [1] the alias of the _first_ pressed key detected; otherwise [false, NULL]

is_any_key_released

read-only
$keymap.is_any_key_released(user: User, keymap: Reference, allow_fallback_input: bool, ignore_input_mode: bool) -> list

Determine if any key within the specified keymap is released.

ParameterTypeMeaning
userUserThe user handle
keymapReferenceThe keymap to perform the check on.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns list: List where [0] indicates if a key was released and [1] the alias of the _first_ released key detected; otherwise [false, NULL]

is_down

read-only
$keymap.is_down(user: User, keymap: Reference, alias: string, remap: bool, allow_fallback_input: bool, ignore_input_mode: bool) -> bool

Test if aliased input is held down.

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap used to determine aliased keys.
aliasstringThe name of the aliased input in the given keymap.
remapboolWhether to consider keymap remapping data of the given user.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns bool: True if the aliased key is down.

is_pressed

read-only
$keymap.is_pressed(user: User, keymap: Reference, alias: string, remap: bool, allow_fallback_input: bool, ignore_input_mode: bool) -> bool

Test if an aliased key changed from up to down this frame.

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap used to determine aliased keys.
aliasstringThe name of the aliased input in the given keymap.
remapboolWhether to consider keymap remapping data of the given user.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns bool: True if the aliased key is pressed.

is_released

read-only
$keymap.is_released(user: User, keymap: Reference, alias: string, remap: bool, allow_fallback_input: bool, ignore_input_mode: bool) -> bool

Test if aliased input changed from down to up this frame.

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap used to determine aliased keys.
aliasstringThe name of the aliased input in the given keymap.
remapboolWhether to consider keymap remapping data of the given user.
allow_fallback_inputboolWhether to allow input when there is no user or no valid connection index.
ignore_input_modeboolWhether to ignore the input mode when checking if the keymap is active.

Returns bool: True if the aliased key was released.

remap

read-only
$keymap.remap(user: User, keymap: Reference, alias: string, keys: list) -> bool

Remap controls for a given user and keymap. Remappings are cached locally until keymap.commit_remap is called.

ParameterTypeMeaning
userUserThe user handle.
keymapReferenceThe keymap.
aliasstringThe name of key alias to remap.
keyslistThe keys to bind, or an empty list to reset to default bindings.

Returns bool: Whether successful.

set_input_mode

$keymap.set_input_mode(user: User, input_mode: int)

Sets input mode state for a given user.

ParameterTypeMeaning
userUserThe user handle.
input_modeintThe input mode to apply.

set_local_network_keymap

$keymap.set_local_network_keymap(keymap: Reference)

Set the gameplay keymap for translating local user key input to actions to send the server.

ParameterTypeMeaning
keymapReferenceThe keymap.

set_remote_network_keymap

$keymap.set_remote_network_keymap(keymap: Reference)

Set the gameplay keymap for translating remote user actions received from the server to key inputs.

ParameterTypeMeaning
keymapReferenceThe keymap.