Jump to content

Question


rockets
 Share

Recommended Posts

here is the script im working on , and i have a question that involves it

while  1
$coordinates1 = pix(0xffe1e6)
if @error <> 1 Then
    MouseClick("left", $coordinates1[0], $coordinates1[1],1,0)
    EndIf
HotKeySet("z", "myexit")
WEnd

func pix($color)
    $coordinatespie = PixelSearch(413, 233, 1010, 695, $color)
    Return $coordinatespie

    EndFunc
Func myexit()
Exit
EndFunc

right now im only getting the coordinates of 1 pixel , if i add

$coordinates2 = pix(0x8ce1e6)
to line 3 then

how would i get it to search if either pixel is active and if it is then to click on it , and how would i keep the script open and have it keep trying to see if any of those pixels are there?

cause when none of the pixels are found the script automatically exits.

any help would be much appreciated , thank you.

Link to comment
Share on other sites

The script has some wrong in it.

HotKeySet("z", "myexit") ;this should be here
While  1
    pixclick(0xffe1e6)
    pixclick(0x8ce1e6) ;you can keep adding more colors if you want
    Sleep(100) ;adjust to however long you want
WEnd

Func pixclick($color) ;this should lessen code repetition
    $coordinates = PixelSearch(413, 233, 1010, 695, $color)
    If @error <> 1 Then
        MouseClick("left", $coordinates[0], $coordinates[1],1,0)
    EndIf
EndFunc

Func myexit()
    Exit
EndFunc
Edited by omikron48
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...