Code: Select all
#Persistent
SetTimer, WatchAxis, 5
SetTimer, WatchPOV, 5
return
WatchPOV:
GetKeyState, POV, JoyPOV
KeyToHoldDownPrev = %KeyToHoldDown%
if POV < 0
KeyToHoldDown =
else if POV = 0
KeyToHoldDown =
; Those 3 are the problem, Im not using up arrow.
else if POV = 9000
Send {Click, 465, 540}
else if POV = 18000
Send {Click, 418, 591}
else if POV = 27000
Send {Click, 379, 540}
WatchAxis:
GetKeyState, JoyX, JoyX,
GetKeyState, JoyY, JoyY,
KeyToHoldDownPrev = %KeyToHoldDown%
if JoyY < 49
KeyToHoldDown = w
else if JoyX < 49
KeyToHoldDown = a
else if JoyY > 51
KeyToHoldDown = s
else if JoyX > 51
KeyToHoldDown = d
else
KeyToHoldDown =
if KeyToHoldDown = %KeyToHoldDownPrev%
return
SetKeyDelay -1
if KeyToHoldDownPrev
Send, {%KeyToHoldDownPrev% up}
if KeyToHoldDown
Send, {%KeyToHoldDown% down}
return
Joy5::MouseClick, left, 430, 535 ; L1
Joy6::MouseClick, left, 580, 535 ; L2
Joy7::MouseClick, left, 430, 580 ; R1
Joy8::MouseClick, left, 580, 580 ; R2
Joy1::Send f
Joy4::Send b
Joy3::Send {Space}
Joy2::MouseClick, left, 940, 605
Using buttoms Joy(number) its easy to click anywhere without any problem, but with JoyPOV I don't know how to use "MouseClick" but click instead, the problem is that as long as I keep the JoyPOV (Joystick arrows) pressed it keep clicking.
I need to change JoyPOV so it click once.
Thank you in advance.
PS: I don't entirely understand the code, I made it with different tutorial on this forum and the guides on ahk page, so If you find something unnecessary or that can be improved feel free to do it so.