Help about mouse move Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Charrly
Posts: 4
Joined: 06 Dec 2021, 12:46

Help about mouse move

Post by Charrly » 06 Dec 2021, 12:49

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
[Mod edit: [code][/code] tags added.]


Hi I have this code but in the code the mouse moves diagonally, I want it to move on the horizontal axis, how can I do this?

User avatar
boiler
Posts: 16912
Joined: 21 Dec 2014, 02:44

Re: Help about mouse move

Post by boiler » 06 Dec 2021, 13:25

Put in 0 where it has a y value in place of what is currently there and leave the x value:

Code: Select all

mouseXY(move, 0)
…where it is currently:

Code: Select all

mouseXY(move, -(move/4))

Charrly
Posts: 4
Joined: 06 Dec 2021, 12:46

Re: Help about mouse move

Post by Charrly » 06 Dec 2021, 13:48

boiler wrote:
06 Dec 2021, 13:25
Put in 0 where it has a y value in place of what is currently there and leave the x value:

Code: Select all

mouseXY(move, 0)
…where it is currently:

Code: Select all

mouseXY(move, -(move/4))
I need some more help, when i enable this code it only moves to the right but i want it to go left and right
Let me summarize exactly what I want to do: 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.

User avatar
boiler
Posts: 16912
Joined: 21 Dec 2014, 02:44

Re: Help about mouse move

Post by boiler » 06 Dec 2021, 14:30

Looks like you're looking for a lot more than the scope of your original question since the script you posted doesn't look like it does anything like that. I'll be glad to answer specific questions if you try to write it and run into problems. Perhaps someone else would be willing to write the code for you if that's what you're looking for.

Charrly
Posts: 4
Joined: 06 Dec 2021, 12:46

Re: Help about mouse move

Post by Charrly » 06 Dec 2021, 16:09

boiler wrote:
06 Dec 2021, 14:30
Looks like you're looking for a lot more than the scope of your original question since the script you posted doesn't look like it does anything like that. I'll be glad to answer specific questions if you try to write it and run into problems. Perhaps someone else would be willing to write the code for you if that's what you're looking for.
https://imgur.com/r8rGwJY
i can explain better with this
The first is what happening now the second is what I want
What should i change for this?
Last edited by Charrly on 06 Dec 2021, 16:17, edited 1 time in total.

User avatar
boiler
Posts: 16912
Joined: 21 Dec 2014, 02:44

Re: Help about mouse move  Topic is solved

Post by boiler » 06 Dec 2021, 16:17

Charrly wrote: What should i change for this?
A lot. You may want to start a new thread asking for someone to write you a script since your question about how to get rid of the diagonal movement has already been answered here. You'll have better luck finding someone to write your script if you post a new thread asking for that.

Post Reply

Return to “Gaming Help (v1)”