I don't have the knowledge to do this Topic is solved

Ask gaming related questions (AHK v1.1 and older)
zhauxu
Posts: 1
Joined: 21 Jul 2022, 18:57

I don't have the knowledge to do this

Post by zhauxu » 21 Jul 2022, 19:04

Hello dear AHK community,
what I am trying to do for hours is, when I press down A+W and C together,
I want AHK to 'counter strafe' meaning hold S + D keys down.
simplified, when pressing A, W and C, hold down S, D till one key is released.

I don't want to share my code since its a complete chaos and hope that someone might be
able to help.

kind regards,
zhau xu

shanshans
Posts: 27
Joined: 13 Dec 2015, 08:10

Re: I don't have the knowledge to do this

Post by shanshans » 22 Jul 2022, 01:06

Code: Select all

a::
send {a down}
return

a up::
send {a up}
if (!getkeystate("s","P")) and (!getkeystate("d","P"))
send {s up}{d up}
return

w::
send {w down}
return

w up::
send {w up}
if (!getkeystate("s","P")) and (!getkeystate("d","P"))
send {s up}{d up}
return

c::
send {c down}
return

c up::
send {c up}
if (!getkeystate("s","P")) and (!getkeystate("d","P"))
send {s up}{d up}
return


#if (getkeystate("a","P")) and (getkeystate("w","P")) and (getkeystate("c","P"))

a::
w::
c::
send {s down}{d down}{c up}{w up}{a up}
return

#if
你好, 隨便弄的... , 應該是這樣吧, 呵呵

Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: I don't have the knowledge to do this  Topic is solved

Post by Rohwedder » 22 Jul 2022, 11:25

Hallo,
try:

Code: Select all

#InstallKeybdHook
SetTimer, CounterStrafe, 50
CounterStrafe := False
Return

CounterStrafe:
IF !CounterStrafe And GetKeyState("a","P") And GetKeyState("w","P") And GetKeyState("c","P")
{
	CounterStrafe := True
	SendInput, {Blind}{a Up}{w Up}{c Up}{s Down}{d Down}
}
Else IF CounterStrafe And (!GetKeyState("a","P") Or !GetKeyState("w","P") Or !GetKeyState("c","P"))
{
	CounterStrafe := False
	SendInput, {s Up}{d Up}
}
Return
#IF CounterStrafe
a::s
w::d
c::Return
#IF

Post Reply

Return to “Gaming Help (v1)”