Jump to content

Trouble using SKSE Input.Holdkey() with mouse buttons


Brehanin

Recommended Posts

I have successfully used the Input.Tapkey() command to create customizable hotkeys for the shouts in my mod, Better Vampires, but I cannot for the life of me get the script to tap or hold a mouse button down ...

 

Here is a sample of my script. This snippet is intended to cast Mortal's Mask by equipping it in the left hand, then simulating a RMouse button press to cast it.

		If BVKeyPressed == BVMortalsMaskHotkey
			If Game.GetPlayer().HasSpell(VampireRemoveHateSpell)
				Game.GetPlayer().EquipSpell(VampireRemoveHateSpell,0)
				Int MappedLeftKey = Input.GetMappedKey("Left Attack/Block")
				Input.HoldKey(MappedLeftKey)
				Utility.Wait(3.0)
				Input.ReleaseKey(MappedLeftKey)
			EndIf
		EndIf

Will Input.Tapkey() and Input.Holdkey() not work for simulating mouse buttons? They work perfectly fine for keyboard keys.

I am using all the correct DXScancodes too - I've confirmed that the MappedKey is 257 (the RMouse button).

 

Any help woudl be greatly appreciated! Can I do this differently?

 

P.S. Ive already tried using the Cast spell procedure, but it casts automatically and doesn't use any Magicka. Also, with the cast procedure, once-a-day powers can be spammed indefinitely, so I wanted to make the use and casting as normal as possible.

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

I have successfully used the Input.Tapkey() command to create customizable hotkeys for the shouts in my mod, Better Vampires, but I cannot for the life of me get the script to tap or hold a mouse button down ...

 

Here is a sample of my script. This snippet is intended to cast Mortal's Mask by equipping it in the left hand, then simulating a RMouse button press to cast it.

		If BVKeyPressed == BVMortalsMaskHotkey
			If Game.GetPlayer().HasSpell(VampireRemoveHateSpell)
				Game.GetPlayer().EquipSpell(VampireRemoveHateSpell,0)
				Int MappedLeftKey = Input.GetMappedKey("Left Attack/Block")
				Input.HoldKey(MappedLeftKey)
				Utility.Wait(3.0)
				Input.ReleaseKey(MappedLeftKey)
			EndIf
		EndIf

Will Input.Tapkey() and Input.Holdkey() not work for simulating mouse buttons? They work perfectly fine for keyboard keys.

I am using all the correct DXScancodes too - I've confirmed that the MappedKey is 257 (the RMouse button).

 

Any help woudl be greatly appreciated! Can I do this differently?

 

P.S. Ive already tried using the Cast spell procedure, but it casts automatically and doesn't use any Magicka. Also, with the cast procedure, once-a-day powers can be spammed indefinitely, so I wanted to make the use and casting as normal as possible.

 

Now I don't like resurrecting old threads (but in this case I do have some insight on why it might be happening).

 

Brehanin2: Have you assigned all the keys using the MCM config menu (or have you assigned some keycode other than 211/Delete)?

 

I ask because in the script:

PlayerVampireQuestScript.psc

 

Function RegisterHotkeys() -- calls RegisterForKey(BVNightVampireVisionHotkey) , etc

BUT after doing that you call UnRegisterForKey(211) -- if you have not set another keycode other than 211 for each of those hotkeys -- it will not work.

 

Furthermore,

in Event OnKeyDown(Int BVKeyPressed) -- you again re-assign the hotkeys (basically duplicating the functionally of RegisterHotkeys() ) rather that using the value already stored.

 

Paricularly you might want to look at these hotkeys:

  1. BVVampiresServantHotkey
  2. BVCorpseCurseHotkey
  3. BVSummonGargoyleHotkey
  4. BVMortalsMaskHotkey
  5. BVIceFleshHotkey
  6. BVBloodWardHotkey
  7. BVFrostCloudHotkey
  8. BVDrainHotkey
  9. BVTollereSanguinareHotkey

if any of these hotkeys are set to 211 -- you will never see an OnKeyDown event fire for them.

 

I recommend assigning unique keycodes to them by default and remove the call to UnRegisterForKey(211) in RegisterHotkeys()

Link to comment
Share on other sites

  • Recently Browsing   0 members

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