Sign in to follow this  
Followers 0
Shonnie

Pixel Detection and IF Statements

3 posts in this topic

$coord = PixelSearch(590, 530, 600, 540, 0x948064, 2)
If Not @error Then
    While 1
        Sleep(1000)
        PixelSearch(590, 530, 600, 540, 0x948064, 2)
        If @error Then
            ExitLoop
        EndIf
    WEnd
Else

rest of the code....

want this snippet to test for a color (or 2 shade variations) and then exit the loop and continue the code

if it doesnt find the color it sleeps for 1 second and then searches for the color again

any help?

Share this post


Link to post
Share on other sites



you can remove the first line.

and then a simple modification. The error occurs when no color is found. So the "If" is used in the opposite way.

While 1
        PixelSearch(590, 530, 600, 540, 0x948064, 2)
        If @error Then
            Sleep(1000)
        Else
            ExitLoop
        EndIf
    WEnd

rest of the code....

Share this post


Link to post
Share on other sites

HA !

Flawless !

Thanks much :rolleyes:

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  
Followers 0