Jump to content

how do I define a zone?


Recommended Posts

Func search_for_this_color ( ;screen width, screen height, color )
    Local $x = 0
    Local $y = 0
    
            Do
                Do
                    If PixelGetColor ( x, y ) = color
                    return (x, y)
                    $y = $y + 1
                Until $y = height
                $y = 0
                $x = $x + 1
            Until $x = $width
        
        Return ( " no such color has been found" )
EndFunc

I am using this func to find out if there is a point on the screen with the color I want, and then it will return the (x, y)

how do I define an area or more on the screen where I do no want the search to be performed?

Link to comment
Share on other sites

Dim $color = 14018275

search_for_this_color ( @DesktopWidth, @DesktopHeight, $color )








Func search_for_this_color ( @DesktopWidth, @DesktopHeight, $color )
    Local $x = 0
    Local $y = @DesktopHeight
    
            Do
                Do
                    If PixelGetColor ( $x, $y ) = $color
                    return ($x & $y)
                    $y = $y - 1
                Until $y = 0
                $y = @DesktopHeight
                $x = $x + 1
            Until $x = @DesktopWidth
        
        Return ( " no such color has been found" )
EndFunc

how do I write the variables to accept multiple returned variables?

Link to comment
Share on other sites

how do I write the variables to accept multiple returned variables?

Usually by either using an array, or by assembling a string with a delimiter, like "|".

:)

P.S. Look at how PixelSearch() returns its values:

Return Value

Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

actually, what I meant is

in the search for this color function above, it's return ($x & $y)

how do I write this properly?

$variable = search_for_this_color ( @DesktopWidth, @DesktopHeight, $color )

Arrays are your friends. Say it with me: "Arrays are our friends".

Func search_for_this_color(@DesktopWidth, @DesktopHeight, $color)
    ; $avRET[0] = X, $avRET[1] = Y
    Local $avRET[2] = [0, @DesktopHeight]
    Do
        Do
            If PixelGetColor($x, $y) = $color Then Return $avRET
            $avRET[1] -= 1
        Until $avRET[1] = 0
        $avRET[1] = @DesktopHeight
        $avRET[0] += 1
    Until $avRET[0] = @DesktopWidth

    Return SetError(1, 0, -1)
EndFunc   ;==>search_for_this_color

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...