I'm trying to make a script which will work in this game. The purpose is to hold down the mouse click, and move the mouse cursor in any of the 4 directions in diagonal of the screen, for every 21.75 pixels on x axis, move 15.362 pixels on y axix.
In it's current form it works if the mouse movement goes from top left towards bottom right, but the problem is the deployment of houses it's not consistent, even if the mouse it's held down and the cursor moves through the correct pathing, often houses skip a place, especially if the start of the move to the end it's really big (from top left corner towards bottom right corner).
Is this a limitation of the autohotkey working with game interface ? Can the script be improved ? Ideally i'd like it to work without missing any space, and the fastest speed possible. Right now it's not fast nor accurate enough
Code: Select all
F2::
{
setmousedelay 5
;setbatchlines 1
stepx := 21.75
stepy := 15.362
delay := 2
multi:= 0.7063
coordmode, Mouse, screen
coordmode, tooltip, screen
MouseGetPos, initialX, initialY
KeyWait, F2
MouseGetPos, finalX, finalY
sleep, 2
if (finalX - initialX >=0)
{
if (finalY - initialY >=0)
{
CalcY := (finalX - initialX) * 0.7063 + initialY
BlockInput, Mousemove
Sleep, 20
Mousemove, InitialX, InitialY
Send, {Click Down}
while (InitialX <= finalX)
{
Mousemove, stepx, stepy, delay, R
InitialX := InitialX + stepx
; Mousemove, finalX, CalcY, 55
}
Send, {Click Up}
BlockInput, MouseMoveOff
}
else
{
CalcY := initialY - (finalX - initialX) * 0.7063
mousemove, initialX, initialY
send, {click, Down}
; sleep, 100
Mousemove, finalX, CalcY, 55
send, {click, Up}
}
}
else
{
If (finalY - initialY >= 0)
{
CalcY := initialY - (finalX - initialX) * 0.7063
mousemove, initialX, initialY
Mousemove, finalX, CalcY, 5
}
else
{
CalcY := initialY + (finalX - initialX) * 0.7063
mousemove, initialX, initialY
Mousemove, finalX, CalcY, 5
}
}
return
}