Issues With Double-Tap Hotkey

Ask gaming related questions (AHK v1.1 and older)
User avatar
coolitic
Posts: 2
Joined: 27 Mar 2017, 21:21

Issues With Double-Tap Hotkey

27 Mar 2017, 21:31

So I have a little script that's supposed to let me "bypass" the double-tap dodge of UT2k4, namely pressing shift to dodge in whatever direction I am moving. However, it only seems to work if I hold shift and THEN tap the button, as opposed to letting me tap shift when I'm holding the button.

Code: Select all

#NoEnv  ;
#Warn  ;
SendMode Input  ;
SetWorkingDir %A_ScriptDir%  ;

+W::
	Send {w up}
	Sleep, 50
	Send {w down}
	Sleep, 50
	Send {w up}
	Sleep, 50
	Send {w down}
	Sleep, 50
	Send {w up}
Return

+A::
	Send {a up}
	Sleep, 50
	Send {a down}
	Sleep, 50
	Send {a up}
	Sleep, 50
	Send {a down}
	Sleep, 50
	Send {a up}
Return

+S::
	Send {s up}
	Sleep, 50
	Send {s down}
	Sleep, 50
	Send {s up}
	Sleep, 50
	Send {s down}
	Sleep, 50
	Send {s up}
Return

+D::
	Send {d up}
	Sleep, 50
	Send {d down}
	Sleep, 50
	Send {d up}
	Sleep, 50
	Send {d down}
	Sleep, 50
	Send {d up}
Return
User avatar
berban
Posts: 97
Joined: 14 Apr 2014, 03:20

Re: Issues With Double-Tap Hotkey

30 Mar 2017, 18:33

Try something like this:

Code: Select all

*LShift::
Keys = wasd ; list of keys
Loop, Parse, Keys ; check each key in the list
	If GetKeyState(A_LoopField, "P") { ; check if that key is pressed
		SendInput {%A_LoopField% up} ; A_LoopField has the current key
		Sleep, 50
		SendInput {%A_LoopField% down}
		Sleep, 50
		SendInput {%A_LoopField% up}
		Sleep, 50
		SendInput {%A_LoopField% down}
		Sleep, 50
		SendInput {%A_LoopField% up}
		Break
	}
Return
User avatar
coolitic
Posts: 2
Joined: 27 Mar 2017, 21:21

Re: Issues With Double-Tap Hotkey

30 Mar 2017, 18:39

it's working! Thanks!

A small problem though: The last SendInput causes it to require me to release and repress WASD, though without it, it would require me to repress and then release.

Is there a way so that it ends in the down state if I'm holding WASD down and in the up state if released?
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Issues With Double-Tap Hotkey

01 Apr 2017, 15:03

I think if you just remove the last sendinput it should continue with the key held down

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: aaa666 and 61 guests