Sign in to follow this  
Followers 0
narayanjr

PixelSearch(), if @error, if not @error

1 post in this topic

While 1
    If _IsPressed("12", $dll) Then
        $coord = PixelSearch(0, 0, 800, 550, $Purple_Color, 1, 1)
        If Not @error Then
            $x = $coord[0]
            $y = $coord[1]
            If PixelGetColor($x + 2, $y) = $Purple_Color Then
                If PixelGetColor($x + 3, $y) = $Purple_Color Then
                    $Check = PixelSearch($x - 16, $y - 2, $x - 11, $y + 5, $XUNIQUES_Color, 1, 1)
                    If Not @error Then
                        Send($Tele_Key)
                        Sleep(100)
                        Mouseclick("right", $x - 25, $y,1,2)
                        Sleep(500)
                        Mouseclick("left",400,263,1,2)
                        Sleep(250)
                    EndIf
                    If @error Then
                        $coord = PixelSearch(0, $y + 15, 800, 550, $XUNIQUES_Color, 1, 1)
                        If Not @error Then
                            $x = $coord[0]
                            $y = $coord[1]
                            If PixelGetColor($x + 2, $y) = $Purple_Color Then
                                If PixelGetColor($x + 3, $y) = $Purple_Color Then
                                    $Check = PixelSearch($x - 16, $y - 2, $x - 11, $y + 5, $XUNIQUES_Color, 1, 1)
                                    If Not @error Then
                                        Send($Tele_Key)
                                        Sleep(100)
                                        Mouseclick("right", $x - 25, $y,1,2)
                                        Sleep(500)
                                        Mouseclick("left",400,263,1,2)
                                        Sleep(250)
                                    EndIf
                                EndIf
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
WEnd

The script is suppose to check the screen for the little purple dash after items names. Once it finds the dash, it checks to see if the items name is gold. If it is then it sends a key, right clicks the item, then left clicks it to pick it up. Up to this point it works, but when it finds the purple dash and the item name is not gold, I want it to continue searching for another purple dash below where it found the first one until it reaches the bottom of the window. I need it to always check the entire screen unless it finds the dash And the gold. The picture at the bottom is an example of when this does not work. Thanks for any help. Any questions about what any one line is suppose to do let me know so i can better help you help me.

Posted Image

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