Jump to content

Pixel Detection and IF Statements


Recommended Posts

$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?

Link to comment
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....
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...