Jump to content
Sign in to follow this  
mrnoob

Pixel Search Cannot Accept Variables

Recommended Posts

mrnoob

Basically, what Im trying to do, is have the script search a large portion of the screen for a pixel, and when it finds that pixel, seach a smaller area around it. But I cant use the variable $Coord as the left, right, top, bottom cooridnants for the PixelSearch command because it gives me the error "Subscript used with non-array variable.

;Searches a large rectangle around the screen for the color
        If $Msg = 4 Then
            $Coord = PixelSearch(61, 121, 1179, 888, 0xF6F6F6, 5, 3)
        Else
            $Coord = PixelSearch(61, 121, 1179, 888, 0x161612, 1, 3)
        EndIf
        
    ;Searches a smaller area around the color
        If UBound($coord)>1 Then
            $Coord2 = PixelSearch($Coord[0] - 65, $Coord[1] - 30, $Coord[0] + 30, $Coord[1] + 65, 0xD9E7FF, 6, 2)
        Else
            $Coord2 = PixelSearch($Coord[0] - 65, $Coord[1], $Coord[0] + 30, $Coord[1] + 65, 0xD9E7FF, 6, 2)
        EndIf

Share this post


Link to post
Share on other sites
Jos

Basically, what Im trying to do, is have the script search a large portion of the screen for a pixel, and when it finds that pixel, seach a smaller area around it. But I cant use the variable $Coord as the left, right, top, bottom cooridnants for the PixelSearch command because it gives me the error "Subscript used with non-array variable.

Are you sure that the PixelSearch() was successful because it doesn't return an Array when its unsuccessful.

Just test for @error after you performed the PixelSearch().


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×