Brehanin Posted July 11, 2013 Posted July 11, 2013 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.
shaynethecoker Posted August 3, 2014 Posted August 3, 2014 Really wish I could help I'm running into the same problem. Bump since this is an old thread
NeoH4x0r Posted December 4, 2015 Posted December 4, 2015 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) , etcBUT 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: BVVampiresServantHotkey BVCorpseCurseHotkey BVSummonGargoyleHotkey BVMortalsMaskHotkey BVIceFleshHotkey BVBloodWardHotkey BVFrostCloudHotkey BVDrainHotkey BVTollereSanguinareHotkeyif 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()
Recommended Posts