How to move the mouse precisely in the game?

Ask gaming related questions (AHK v1.1 and older)
makeqiaqia
Posts: 1
Joined: 13 Jun 2021, 22:35

How to move the mouse precisely in the game?

Post by makeqiaqia » 17 Jun 2021, 07:05

Hey, guys. I m having a problem scripting for Defense Grid 2 in AHK. That is how the mouse moves precisely in the game. That is the effect in the first video that I wrote in Quick Macro. But in AHK I didn t find a way to implement it and could only produce effects as in the second video.

I have tried four modes of SendMode, Only Event mode can move, the effect is like the second video, an effect of moving back and forth. Clearly, this does not meet the requirement of precise control. Do you have any way? Thank you very much!

Link to the first video for Quick Macro: www.bilibili.com/video/BV1m54y1G7Rn/
Link to the second video for AHK:www.bilibili.com/video/BV1E5411T76R/

Here is the AHK code :

Code: Select all

;Input/Play/Event/InputThenPlay
SendMode, Event
WinActivate, Defense Grid 2
Sleep, 1000
Send, {BackSpace}
Sleep, 1000
Send, {Space}
Sleep, 1000
MouseClick
Sleep 1000
loop,10
{
	;Send or MouseMove is  Invalid
	;Send, {a 10}
	MouseMove, -10, 0 , 100,R
	Sleep, 1000
	;
}
2021/6/19 Update:

All attempts ended in failure, including all the methods mentioned in another article, the link is here:https://autohotkey.com/board/topic/111737-how-to-make-ahk-work-in-most-games-the-basics/.I think that the script simulates the movement and click of the mouse, which is a basic function that must be possessed, like the foundation of a building. And AHK's performance in this regard is very disappointing. Or I haven't found a solution yet, but even if it can be solved, it may be very troublesome.

In the end, I called the function of the third-party library to realize the precise movement of the mouse. Some people may say that this is not solved? I think that whether this problem is solved or not is not the key. The key is that if the AHK is connected to the most basic mouse Mobile must borrow third-party libraries, so why don't users choose other scripting languages to call third-party libraries? For example, Python + third-party libraries, which can avoid the harm of strange syntax.

Finally, this reply comes from Google Translate, and I pray that Google will make my thoughts clear.

Return to “Gaming Help (v1)”