Jump to content
Sign in to follow this  
glarson

help with error counting

Recommended Posts

glarson

I want to count how many time a loop is executed if a color range is not seen. When the number reaches a set value then a function is executed else the number is reset to 0 and the script continues.

Am I doing this the right way? Here is an example.

CODE
Func LockTarget()

$irc=0

PrintStatus("Locking Target.")

MouseClick("left",960,135,1,$MouseSpeed);;lock target - modify pixel location to pick up red X when locked

Do

$Color=PixelGetColor(959,134); looking for the Red X in the Lock/Unlock button in Overvire Info Window

$iRedColor=_ColorGetRed($Color)

$iGreenColor=_ColorGetGreen($Color)

$iBlueColor=_ColorGetBlue($Color)

If $iRedColor<189 And $iGreenColor>48 And $iBlueColor>57 Then

$irc=$irc+1

Sleep(10)

If $irc=9000 Then

MouseClickDrag("left",750,350,600,350,$MouseSpeed)

Sleep(200)

$irc=0

ResetLock()

EndIf

Else

$irc=0

Sleep(100)

EndIf

Until $irc=0

Sleep(500)

Do

PixelSearch(922,93,929,93,0x9c9a9c,40);; pixel search for "m" in distance readout

Until @error=0

Sleep(500)

StopShip()

Return 5

EndFunc

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  

×