Skip to content

Custom Hotkeys

Defined in: packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:7

  • Feature

setConditionalHotkey(getKeyFunc, triggerFunc): void

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

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 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.

() => Keyboard | undefined

The function that returns the key that will trigger the hotkey.

() => void

A function containing the arbitrary code that you want to execute when the hotkey is triggered.

void

setHotkey(keyboard, triggerFunc): void

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

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 in the POST_RENDER callback.

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

Keyboard

The key that you want to trigger the hotkey.

() => void

A function containing the arbitrary code that you want to execute when the hotkey is triggered.

void

unsetConditionalHotkey(getKeyFunc): void

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

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.

() => Keyboard | undefined

Equal to the getKeyFunc that you passed when initially registering the hotkey.

void

unsetHotkey(keyboard): void

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

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.

Keyboard

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

void