glarson Posted October 12, 2007 Posted October 12, 2007 (edited) I want to count how many times an error occurs in a loop and when it reaches a set number it calls for a function, else it continues on to the next function. Here is the script I'm using. Is there a better way to do this? Func LockTarget() $rtlc=0 PrintStatus("Locking Target.") MouseClick("left",959,134,1,$MouseSpeed);;lock target - modify pixel location to pick up red X when locked Do PixelSearch(959,134,960,135,0xe70000,45); looking for the Red X in the Lock/Unlock button in Overvire Info window. If @error=1 Then $rtlc=$rtlc+1 Sleep(10) If $rtlc=6000 Then ResetLock() EndIf EndIf Until @error=0 Sleep(2000) Do PixelSearch(922,93,929,93,0x9c9a9c,40);; pixel search for "m" in distance readout Until @error=0 Sleep(2000) If $z>=50 Then;;approach StopShip() EndIf Return 5 EndFunc Edited October 12, 2007 by glarson
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now