When I start the code, the mouse should move from the center of the screen to the right, then directly across from the midpoint, then back to the point opposite the midpoint, and so on until I take my hand off the button. I appointed. Ps: Press the d key while moving the mouse to the right, the a key should be pressed while moving the mouse to the left. The most important point is that the code travels x distances when it first starts, then it has to travel 2x continuously.
Code: Select all
SendMode, Input
SetBatchLines -1
CoordMode, Mouse, Screen
mouseXY(x, y)
{
DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
}
strafe(left)
{
moveCount := 15
sleepInterval := 4
relativeMove := 55
if (left)
{
key := "d"
move := relativeMove
} else
{
key := "a"
move := -relativeMove
}
send {%key% down}
DllCall("Sleep", "UInt", 10)
Loop, %moveCount%
{
mouseXY(move, -(move/4))
DllCall("Sleep", "UInt", sleepInterval)
}
send {%key% up}
}
$Q::
while getkeystate("Q","P")
{
strafe(true)
strafe(false)
}
return
https://imgur.com/r8rGwJY
i want like second one in this picture