I am relatively new in AHK so I apologize for my basic lack of knowledge. I have the following script:
xpos1=
xpos2=
SetMouseDelay,-1
SetBatchLines, -1
col_outher_circle=0xFFFFFF
col_gray_area=0x46362E
col_inner_circle=0x5C80BC
col_background=0x352923
Process, Priority,, High
findTarget(xpos1, ypos1, xpos2, ypos2){
PixelSearch, Px, Py, xpos1, ypos1, xpos2, ypos2, col_inner_circle, 5, Fast
Send {Space}
}
f1::
If xpos1 =
{
MouseGetPos, xpos1, ypos1
Msgbox, xpos1=%xpos1% and ypos1=%ypos1% are set!
Return
}
If xpos2 =
{
MouseGetPos, xpos2, ypos2
Msgbox, xpos2=%xpos2% and ypos2=%ypos2% are set!
}
Loop{
PixelSearch, grayXleft, grayY, xpos1, ypos1, xpos2, ypos2, col_gray_area, 5, Fast
Msgbox, grayXleft=%grayXleft% / grayY=%grayY%
grayXright:=getRightXofGray(grayXleft, grayY) ; return result here is nothing and grayXright is set to blank
Msgbox, no more gray. grayXleft=%grayXleft% and grayXright=%grayXright%
findTarget(xpos1, ypos1, xpos2, ypos2)
}
getRightXofGray(grayXleft, grayY){
PixelGetColor, Color, grayXleft, grayY
grayXleft:=grayXleft+15
PixelGetColor, NewColor, grayXleft, grayY
Msgbox, Color is %Color% and NewColor is %NewColor%
if (Color == NewColor) {
Msgbox, newcolor is gray and grayXleft=%grayXleft% / grayY=%grayY%
getRightXofGray(grayXleft, grayY)
} else {
Msgbox, newcolor is NNNNNNNOOOOOOTTTTTTTTTTTTTTTTTTTTTTT gray
return grayXleft-15
}
}
f3::Pause
f2::
Msgbox, Reloading script..
reload ;exitapp
I tried using Global for grayXright as well but it is still blank. When I output the info inside the else case in the getRightXofGray() function all is good.
Where am I making a mistake?
return.if (Color == NewColor)branch is missing areturn.