Difference between revisions of "OnKeyDown - ScriptObject"
Jump to navigation
Jump to search
imported>Kyllagdrgn |
imported>Qazaaq (Replaced input script with DX Scan Code) |
||
Line 6: | Line 6: | ||
Minimum required F4SE Version: 0.3.0 | Minimum required F4SE Version: 0.3.0 | ||
Listens for the pressing of keys whose [[ | Listens for the pressing of keys whose [[DirectX Scan Codes|Scan Codes]] have been registered via [[RegisterForKey - ScriptObject|RegisterForKey]]. | ||
== Syntax == | == Syntax == | ||
<source lang="papyrus">Event OnKeyDown( | <source lang="papyrus">Event OnKeyDown(int keyCode)</source> | ||
== Parameters == | == Parameters == | ||
*KeyCode: The [[ | *KeyCode: The [[DirectX Scan Codes|Scan Code]] of a key press to listen for. | ||
== Examples == | == Examples == | ||
<source lang="papyrus">Event OnKeyDown( | <source lang="papyrus"> | ||
Event OnKeyDown(int keyCode) | |||
Debug.Trace("A registered key has been pressed") | |||
If (keyCode == 160) | |||
Debug.Trace("L-Shift is registered and has been pressed") | |||
EndEvent</source> | EndIf | ||
EndEvent | |||
</source> | |||
== Notes == | == Notes == | ||
Line 28: | Line 29: | ||
== See Also == | == See Also == | ||
*[[ScriptObject Script]] | *[[ScriptObject Script]] | ||
*[[RegisterForKey - ScriptObject]] | *[[RegisterForKey - ScriptObject]] | ||
*[[UnregisterForKey - ScriptObject]] | *[[UnregisterForKey - ScriptObject]] | ||
*[[OnKeyUp - ScriptObject]] | *[[OnKeyUp - ScriptObject]] | ||
*[[DirectX Scan Codes]] |
Revision as of 15:02, 6 April 2017
F4SE Member of: ScriptObject Script
Minimum required F4SE Version: 0.3.0
Listens for the pressing of keys whose Scan Codes have been registered via RegisterForKey.
Syntax
Event OnKeyDown(int keyCode)
Parameters
- KeyCode: The Scan Code of a key press to listen for.
Examples
Event OnKeyDown(int keyCode)
Debug.Trace("A registered key has been pressed")
If (keyCode == 160)
Debug.Trace("L-Shift is registered and has been pressed")
EndIf
EndEvent
Notes
- If multiple keys are registered, you'll want to differentiate in the event body as demonstrated above. If only one key will be registered for the form, such differentiation is not necessary.