RegisterForKey - Form

From the CreationKit Wiki
Jump to navigation Jump to search

SKSE Member of: Form Script

Minimum required SKSE Version: 1.06.00

Registers the given DXScanCode for OnKeyDown and OnKeyUp events. (This function requires SKSE)

Syntax[edit | edit source]

Function RegisterForKey(Int KeyCode) Native

Parameters[edit | edit source]

Return Value[edit | edit source]

NONE

Examples[edit | edit source]

RegisterForKey(42) ; L-Shift

Notes[edit | edit source]

  • Use of the input events is much less resource consumptive than polling for IsKeyPressed in an OnUpdate event. Whenever possible, use the events preferentially.
  • Avoid using keys already claimed by Skyrim. Invariably, mod added hotkeys will conflict, so it's best to offer a way to rebind your hotkey(s) via GetNthKeyPressed from an Options Menu or other readily accessible means such as a scripted inventory item. This will afford your mod elasticity and allow it to work in tandem with other hotkey bearing mods.
  • Using a property to store the DXScanCode of the key you are listening for will allow the same script to be easily reused to listen for different keys simultaneously, as this allows the property to be set (or the default value overridden) in the Creation Kit without editing the script's source

See Also[edit | edit source]