Difference between revisions of "RegisterForKey - ScriptObject"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Qazaaq
m
imported>Qazaaq
m (Added a trace to the example)
Line 9: Line 9:


== Syntax ==
== Syntax ==
<source lang="papyrus">Function RegisterForKey(Int Key) Native</source>
<source lang="papyrus">Function RegisterForKey(int key) Native</source>


== Parameters ==
== Parameters ==
*KeyCode: The [[DirectX Scan Codes|Scan Code]] of the key to listen for.
*keyCode: The [[DirectX Scan Codes|Scan Code]] of the key to listen for.


== Return Value ==
== Return Value ==
Line 18: Line 18:


== Examples ==
== Examples ==
<source lang="papyrus">RegisterForKey(160) ; L-Shift</source>
<source lang="papyrus">
int LeftShift = 160 const
RegisterForKey(LeftShift)
Debug.Trace("The " + LeftShift + " key has been registered for events.")
</source>


== Notes ==
== Notes ==

Revision as of 18:20, 6 April 2017

F4SE Member of: ScriptObject Script

Minimum required F4SE Version: 0.3.0

Registers the given Scan Code for OnKeyDown and OnKeyUp events.

Syntax

Function RegisterForKey(int key) Native

Parameters

  • keyCode: The Scan Code of the key to listen for.

Return Value

None

Examples

int LeftShift = 160 const
RegisterForKey(LeftShift)
Debug.Trace("The " + LeftShift + " key has been registered for events.")

Notes

See Also