I need a little help with this part of my code, it works but not as well as i'd like.
It seems to get confused which way to face the close to the center the mouse gets.
Code: Select all
global charCenterX := 965
global charCenterY := 458
AreaSpell(spell)
{
workingArea := 300
deadZone := 50
MouseGetPos, nowX, nowY
;Top Left
if (nowY < (charCenterY - deadZone) && (nowX > (charCenterX - workingArea)) && (nowX < (charCenterX + workingArea)) )
{
Send +{Up}
RandomSleep(50,100)
Send, % spell
}
else if (nowX < (charCenterX - deadZone) && (nowY > (charCenterY - workingArea)) && (nowY < (charCenterY + workingArea)) )
{
Send +{Left}
RandomSleep(50,100)
Send, % spell
}
;BottomRight
if (nowY > (charCenterY + deadZone) && (nowX > (charCenterX - workingArea)) && (nowX < (charCenterX + workingArea)) )
{
Send +{Down}
RandomSleep(50,100)
Send, % spell
}
else if (nowX > (charCenterX + deadZone) && (nowY > (charCenterY - workingArea)) && (nowY < (charCenterY + workingArea)) )
{
Send +{Right}
RandomSleep(50,100)
Send, % spell
}
}