ahk request

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

ahk request

12 Aug 2018, 19:05

like everyone who requests scripts like this, i have almost no coding knowledge so i dont know how to use autohotkey. let me just get to the point.

i would like a script that does this:



1) if wasd is released, ignore the release

2) while ignoring the release, stop mouse movement

3) release wasd

4) restore the mouse movement





the reason for this is because ive been experiencing this common fallout: new vegas bug where if the mouse is moving and you stop, you slide forward. so if i run an ahk to do these steps i think it might fix it by just making it physically impossible to recreate it.

thank you very much to whoever ends up helping me, it means A LOT!
Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: ahk request

13 Aug 2018, 02:00

Hallo,
try:

Code: Select all

~*w::Return
~*a::Return
~*s::Return
~*d::Return
$*w Up:: ;1) if wasd is released, ignore the release
$*a Up::
$*s Up::
$*d Up::
Key := "{Blind}{" SubStr(A_ThisHotkey,3) "}"
BlockInput, MouseMove ;2) while ignoring the release, stop mouse movement
Sleep, 2000
Send, % Key ;3) release wasd
BlockInput, MouseMoveOff ;4) restore the mouse movement
Return
You have not defined when 3) should happen.
That's why I put in a "Sleep, 2000".
pro100andrik94
Posts: 27
Joined: 08 Aug 2018, 07:27

Re: ahk request

13 Aug 2018, 02:07

Code: Select all

loop
{
if GetKeyState("w") or GetKeyState("a") or GetKeyState("s") or GetKeyState("d")
blockinput mousemove
else 
blockinput mousemoveoff
}
return
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

Re: ahk request

13 Aug 2018, 21:12

any way to make it function for games that use delta mouse movement? (where the mouse stays in the middle in order to move the camera)
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

Re: ahk request

13 Aug 2018, 21:15

oh and thanks for the help btw
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

Re: ahk request

15 Aug 2018, 17:35

i wasnt very clear in my original post cause i didnt know that the delta mouse movement was a problem until i actually tested the code. i also need the code to use dllcall "mouse_event" in order to actually work with fallout new vegas. i feel like im asking a lot since it probably requires completely rewriting the code. sorry if i was unclear before.
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

Re: ahk request

18 Aug 2018, 16:43

bump
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

Re: ahk request

23 Aug 2018, 17:44

how many times must i bump this?
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: ahk request

24 Aug 2018, 07:49

i dont have the game so i cant test it out, but it for sure sounds like an annoying af glitch. try this:

Code: Select all

; block mouse and keyboard input via user32.dll\BlockInput,
; while Click/MouseMove/MouseClick/MouseClickDrag in progress
BlockInput Mouse

; on release
~*w Up::
~*a Up::
~*s Up::
~*d Up::
	; send dummy relative mousemove event
	; just to trigger BlockInput for a split second
	MouseMove 0, 0, 0, R
return

Esc::ExitApp
maybe this would work too:

Code: Select all

~*w Up::
~*a Up::
~*s Up::
~*d Up::
	key := SubStr(A_ThisHotkey, 3)
	BlockInput On
	Send % "{Blind}{" key " Down}"
	Sleep 50
	Send % "{Blind}{" key " Up}"
	BlockInput Off
return

Esc::ExitApp
but truth be told depending on how the game interprets the input to produce this glitch, what ure asking for might be impossible. take a look at this:
1) if wasd is released, ignore the release - the release has already happened to trigger this, hence impossible to ignore it
2) while ignoring the release, stop mouse movement - releasing is a discrete event
DarkACB
Posts: 7
Joined: 12 Aug 2018, 18:52

Re: ahk request

25 Aug 2018, 20:37

the first one just reset the camera up or down, and the second didnt work at all. maybe its possible to rebind the wasd keys to something else like the arrow keys in the game, then make ahk press those keys. maybe that would make the ignore release possible?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, RandomBoy and 410 guests