I've detected a new problem that defies my very limited coding ability. The ClickOffsetOfImage function seems to be incapable of returning a False value like ClickImage does. ClickImage works like so:
Func ClickImage($directory,$img,$tolerance=50,$startX=0 ,$startY=0,$endX=@DesktopWidth,$endY=@DesktopHeigh t,$seconds=$defaultCheckRate)
If CheckFor($directory,$img,$tolerance,$startX,$start Y,$endX,$endY,$seconds) Then
MouseClick("left",$gX,$gY,1,0)
Return True
Else
Return False
EndIf
EndFunc
Basically, check for [some image], if you see that image, do some stuff and return a True boolean, otherwise return a False boolean. And here is ClickOffsetOfImage:
Func ClickOffsetOfImage($direction,$offset,$directory,$ img,$clicks=1,$tolerance=50,$startX=0,$startY=0,$e ndX=@DesktopWidth,$endY=@DesktopHeight,$seconds=$d efaultCheckRate)
If CheckFor($directory,$img,$startX,$startY,$endX,$en dY,$seconds,$tolerance) Then
If $direction = "right" Then
$gX += $offset
ElseIf $direction = "left" Then
$gX -= $offset
ElseIf $direction = "up" Then
$gY -= $offset
ElseIf $direction = "down" Then
$gY += $offset
EndIf
MouseClick("left",$gX,$gY,$clicks,0)
Return True
Else
Return False
EndIf
EndFunc
Same basic setup. Check for the image, if you see it, do some stuff, then return a True. Otherwise, do nothing and return a False.
However, the latter function will not return a False statement for me, causing the script to hang. I am trying to use it to speed up the script immensely and improve its recognition to nearly 100%. If my ClickOffset.... function detects the image on-screen, it clicks where I need it to, goes into WaitForAttack, attacks the managog, everything is wonderful. So clearly, the Return True works. However, if there is no managog on-screen, it simply hangs on that function indefinitely; it cannot arrive at the Else > Return False, which comes right after the Return True that is working.
The only difference is the embedded If statement. Is the compiler ending the original If statement with the embedded EndIf, preventing the script from knowing what to do with the Else statement? Any advice from real coders would be appreciated.