Jump to content

How to keep clicking untill @error


lolp1
 Share

Recommended Posts

I'm trying to make a simple func, and have a simple question.

Once it finds the pixel, I want it to keep clicking the pixel untill the pixel is gone, then stop clicking the pixel untill it finds another one, this is wht I have now:

While 1   
             $pixel = PixelSearch(275, 180, 800, 640, 0xFB00FF, 15)   
             $pixel2 = PixelSearch(275, 180, 800, 640, 0xB90D9B, 15)   
                  If Not @error Then  
                           Do 
                           MouseClick("left", $pixel[0], $pixel[1], 2, 0)   
                           Sleep(1000)   
 Until @error 
                  ElseIf Not @error Then  
 Do 
                           MouseClick("left", $pixel2[0], $pixel2[1], 2, 0)   
                           Sleep(1000)  
 Until @error 
                  EndIf   
        WEnd

How ever this doesnt work, any suggestions?

Link to comment
Share on other sites

Not sure if this is what you're looking for, but let me know =)

Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
$searchcolor = 0xFB00FF
$searchcolor2 = 0xB90D9B

While 1
Sleep(50)
$coord = PixelSearch(10, 10, 800, 580, $searchcolor)
$coord2 = PixelSearch(10, 10, 800, 580, $searchcolor2)
If IsArray($coord) = 1 Then
MouseClick('left', $coord[0], $coord[1], 1, 0)
ElseIf IsArray($coord2) = 1 Then
MouseClick('left', $coord2[0], $coord2[1], 1, 0)
EndIf
Wend
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...