Skip to main content

Custom Hotkeys

Hierarchy

  • Feature

    CustomHotkeys

Methods

setConditionalHotkey

setConditionalHotkey(getKeyFunc, triggerFunc): void

Helper function to run arbitrary code when you press and release a specific keyboard key.

This can be used to easily set up custom hotkeys to facilitate custom game features or to assist in debugging.

Inputs are checked for in the POST_RENDER callback.

This is different from the setHotkey function in that the keyboard activation key is not hardcoded and is instead the return value of a provided function. This is useful for situations where the key can change (like if end-users can specify a custom hotkey using Mod Config Menu).

In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.

Parameters

NameTypeDescription
getKeyFunc() => undefined | KeyboardThe function that returns the key that will trigger the hotkey.
triggerFunc() => voidA function containing the arbitrary code that you want to execute when the hotkey is triggered.

Returns

void

Defined in

packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:79


setHotkey

setHotkey(keyboard, triggerFunc): void

Helper function to run arbitrary code when you press and release a specific keyboard key.

This can be used to easily set up custom hotkeys to facilitate custom game features or to assist in debugging.

Inputs are checked for in the POST_RENDER callback.

In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.

Parameters

NameTypeDescription
keyboardKeyboardThe key that you want to trigger the hotkey.
triggerFunc() => voidA function containing the arbitrary code that you want to execute when the hotkey is triggered.

Returns

void

Defined in

packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:108


unsetConditionalHotkey

unsetConditionalHotkey(getKeyFunc): void

Helper function to remove a hotkey created with the setConditionalHotkey function.

In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.

Parameters

NameTypeDescription
getKeyFunc() => undefined | KeyboardEqual to the getKeyFunc that you passed when initially registering the hotkey.

Returns

void

Defined in

packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:128


unsetHotkey

unsetHotkey(keyboard): void

Helper function to remove a hotkey created with the setHotkey function.

In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.

Parameters

NameTypeDescription
keyboardKeyboardEqual to the keyboard value that you passed when initially registering the hotkey.

Returns

void

Defined in

packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:148