Page 1 of 1

Strafe macro

Posted: 06 Dec 2021, 16:24
by Charrly
Hi i want a strafe macro
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
i have this code but its not working like i want. This code works like the first but I want like the second. Can u help me about what should i change in this code or can u type a code like i want.
https://imgur.com/r8rGwJY
i want like second one in this picture