Jump to content

Papyrus TapKey


jbezorg

Recommended Posts

Posted

https://www.creationkit.com/index.php?title=TapKey_-_Input

 

I had 2 issues and I couldn't find the mod or mods that was causing it.
 

  1. After playing for a while. Some mod would be spamming a key with TapKey() while I was trying to save. It would reset my save/load selection over and over.
  2. Recently. Another mod, probably after an update, started spamming TapKey() when the MCM menu was open. This is especially annoying when you are in MCM trying to configure a mod's key configuration.

 

If you really think you HAVE to use TapKey() then make sure it's not when a menu is open. To address script lag. Perform the check as late a possible and right before TapKey() is used.
 

if ( !Utility.IsInMenuMode() )
  Input.TapKey( dxKeycode )
endIf


How do I know TapKey() was the problem when I can't name the mod(s)? Occam's Razor. The simplest solution is almost always the best. I recompiled Input.psc to disable TapKey() and the issues went away. 
 

Scriptname Input Hidden

; returns whether a key is pressed
bool Function IsKeyPressed(Int dxKeycode) global native

; taps the specified key
; Function TapKey(Int dxKeycode) global native
Function TapKey(Int dxKeycode) global
  ; Nope. Ain't gonna' do it.
EndFunction

; holds down the specified key until released
Function HoldKey(Int dxKeycode) global native

; releases the specified key
Function ReleaseKey(Int dxKeycode) global native

; how many keys are pressed
int Function GetNumKeysPressed() global native

; for walking over the pressed keys
int Function GetNthKeyPressed(int n) global native

; returns keycode bound to a control for given device
;
; Valid controls:
;	"Forward", "Back", "Strafe Left", "Strafe Right", "Move", "Look", "Left Attack/Block", "Right Attack/Block"
;	"Activate", "Ready Weapon", "Tween Menu", "Toggle POV", "Zoom Out", "Zoom In", "Jump", "Sprint", "Shout",
;	"Sneak", "Run", "Toggle Always Run", "Auto-Move", "Favorites", "Hotkey1", "Hotkey2", "Hotkey3", "Hotkey4",
;	"Hotkey5", "Hotkey6", "Hotkey7", "Hotkey8", "Quicksave", "Quickload", "Wait", "Journal", "Pause", "Screenshot",
;	"Multi-Screenshot", "Console", "CameraPath", "Quick Inventory", "Quick Magic", "Quick Stats", "Quick Map"
;
; Valid device types:
;	(default)	auto detect
;	0			keyboard
;	1			mouse
;	2			gamepad
int Function GetMappedKey(string control, int deviceType = 0xFF) global native

; returns name of control bound to given keycode, or "" if unbound
string Function GetMappedControl(int keycode) global native

 

I'm going to keep the modified Input.pex file. Between the Default keys of the Game and mods like, SexLab, iNeed, Hunterborn, etc. I'm not going to hunt down the mod or mods that are using TapKey(). Then create a cross-reference chart of all my loaded mod's control keys along with the game's control keys and under what conditions they are used in order to find a Unicorn Key. The mythical control key that no mod uses, that no mod will ever be updated to use, and isn't used in the game's controls that's safe for TapKey().

Nope. Ain't gonna' do it.

Input.pex

  • 7 months later...
Posted
42 minutes ago, Monoman1 said:

 

I read your post, it looks like an "any key pressed" function.

This can be interesting in case you launch some automated function (imput.registerforkey(0)at this time ), that can be interrupted by player this way.

ex : auto walk home => if player press a key it will stop it

Or is it more interesting to register all keys ? ...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...