Difference between revisions of "GetMappedKey - Input"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
(Fixed.)
 
imported>Pickysaurus
(→‎Return Value: Clarified what happens if the key is not mapped)
 
(6 intermediate revisions by 3 users not shown)
Line 57: Line 57:
:*Zoom Out
:*Zoom Out
*DeviceType: The device type used. Valid devices listed below.
*DeviceType: The device type used. Valid devices listed below.
:*255 = Auto detect (Default)
:*0xFF = 255 = Auto detect (Default)
:*0 = Keyboard
:*0x00 = 0 = Keyboard
:*1 = Mouse
:*0x01 = 1 = Mouse
:*2 = Gamepad
:*0x02 = 2 = Gamepad
 
== Return Value ==
== Return Value ==
Returns [[Input_Script#DXScanCodes|DXScanCode]] bound to a control for given device as an integer.
Returns [[Input_Script#DXScanCodes|DXScanCode]] bound to a control for given device as an integer. If the key is not mapped (common for things like "Quick Inventory" when using a controller) returns -1.


== Examples ==
== Examples ==
<source lang="papyrus">Int iForwardKey = GetMappedKey("Forward")</source>
*Standard use:
<source lang="papyrus">Int iForwardKey = Input.GetMappedKey("Forward")</source>
*Record all DxScanCodes currently used by Skyrim:
<source lang="papyrus">Int[] Property iDxScanCode Auto ; 43 elements
String[] Property sControlName Auto ; Also 43 elements that indices will correspond. Elements must be filled in creation Kit.
 
Function RecordControlKeys()
Int iIndex = sControlName.Length
While iIndex > 0
iIndex -= 1
iDxScanCode[iIndex] = Input.GetMappedKey(sControlName[iIndex])
EndWhile
EndFunction</source>


== Notes ==
== Notes ==

Latest revision as of 07:04, 22 December 2019

SKSE Member of: Input Script

Minimum required SKSE Version: 1.06.00

Returns the DXScanCodes bound to a control for given device. (This function requires SKSE)

Syntax[edit | edit source]

Int Function GetMappedKey(String Control, Int DeviceType = 0xFF) Global Native

Parameters[edit | edit source]

  • Control: The name of the controls as a string. Valid controls listed below.
  • Activate
  • Auto-Move
  • Back
  • CameraPath
  • Console
  • Favorites
  • Forward
  • Hotkey1
  • Hotkey2
  • Hotkey3
  • Hotkey4
  • Hotkey5
  • Hotkey6
  • Hotkey7
  • Hotkey8
  • Journal
  • Jump
  • Left Attack/Block
  • Look
  • Move
  • Multi-Screenshot
  • Pause
  • Quick Inventory
  • Quick Magic
  • Quick Map
  • Quick Stats
  • Quickload
  • Quicksave
  • Ready Weapon
  • Right Attack/Block
  • Run
  • Screenshot
  • Shout
  • Sneak
  • Sprint
  • Strafe Left
  • Strafe Right
  • Toggle Always Run
  • Toggle POV
  • Tween Menu
  • Wait
  • Zoom In
  • Zoom Out
  • DeviceType: The device type used. Valid devices listed below.
  • 0xFF = 255 = Auto detect (Default)
  • 0x00 = 0 = Keyboard
  • 0x01 = 1 = Mouse
  • 0x02 = 2 = Gamepad

Return Value[edit | edit source]

Returns DXScanCode bound to a control for given device as an integer. If the key is not mapped (common for things like "Quick Inventory" when using a controller) returns -1.

Examples[edit | edit source]

  • Standard use:
Int iForwardKey = Input.GetMappedKey("Forward")
  • Record all DxScanCodes currently used by Skyrim:
Int[] Property iDxScanCode Auto ; 43 elements
String[] Property sControlName Auto ; Also 43 elements that indices will correspond. Elements must be filled in creation Kit.

Function RecordControlKeys()
	Int iIndex = sControlName.Length
	While iIndex > 0
		iIndex -= 1
		iDxScanCode[iIndex] = Input.GetMappedKey(sControlName[iIndex])
	EndWhile
EndFunction

Notes[edit | edit source]

None

See Also[edit | edit source]