Jump to content
Sign in to follow this  
glarson

error counting

Recommended Posts

glarson

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 by glarson

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.