PenMasterPeon Posted March 6, 2005 Posted March 6, 2005 (edited) Hey guys, I've been having trouble with this pixel search function. First part of the program: Dim $Click[2] Second Part of the program: $Click = PixelSearch($XMin, $YMax, $XMax, $YMin, 3675204, 10) Sleep(5000 + Random($SleepMin, $SleepMax)) MouseClick("Left", $Click[1], $Click[2], 1, 1) It says that I am using a subscript for a non array variable, but i dimmed it as an array before! Alot of help would be thx! =D EDIT: I added the 10 shade variation at the end because it wasn't working. Edited March 6, 2005 by PenMasterPeon
the_lord_mephy Posted March 6, 2005 Posted March 6, 2005 AFAIK you don't need the dim statement in the beginning. Then you need to use the subscripts [0] and [1]. That's why it's giving you the subscripts exceeded Error. $Click[2] Doesn't exist My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
PenMasterPeon Posted March 6, 2005 Author Posted March 6, 2005 (edited) K, I deleted the dim at the beginning and used 0 1 subscripts but i'm getting the same error it says: MouseClick("Left", $Click[0], $Click[1], 1, 1) MouseClick("Left", $Click^ ERROR Error: Subscript used with non-Array variable. do i need to make it sleep after the pixel search? EDIT: maybe i'm not doing the coordinates correctly. okay, i'm using a 806 width and 638 height window. what would be the values if i were to pixel search the entire window? Edited March 6, 2005 by PenMasterPeon
phillip123adams Posted March 6, 2005 Posted March 6, 2005 $Click = PixelSearch($XMin, $YMax, $XMax, $YMin, 3675204, 10)<{POST_SNAPBACK}>When PixelSearch does not find the specified color, it returns the integer 1 instead of an array, and that produces the subscript error when you attempt to use it as if it were an array.Before using the result of PixelSearch, check to see if it succeeded or not using the IsArray function or the @error macro (see the help file example for PixelSearch). Phillip
PenMasterPeon Posted March 6, 2005 Author Posted March 6, 2005 oommmggg how is it failing? i changed it to 50 shade variations and it still didn't work! ahhhhhhhhhhhhhh
Pickled Posted March 6, 2005 Posted March 6, 2005 (edited) oommmggg how is it failing? i changed it to 50 shade variations and it still didn't work! ahhhhhhhhhhhhhh<{POST_SNAPBACK}>Your syntax is not testing to see if CLICK [0] even exists first!Also im not sure what the xMin , xMax etc are so... lets have a look at working way I use to assign a pixel search to $x, $y$search = PixelSearch ($left, $top, $right, $bottom, $color) If(@error <> 1) Then $x = $search[0] $y = $search[1] MouseClick("left", $x, $y) Else ;Failed to assign Array[0],[1] (x,y) ..... EndIfThis is a safer way of doing it then you won't get NON-ARRAY variable error (eg. it FAILED TO FIND the color and ASSIGN AN ARRAY, therefore BANG!! - passing a NON ARRAY to Click (which evidentally would then = int (non array var) )) Edited March 6, 2005 by Pickled
therks Posted March 6, 2005 Posted March 6, 2005 (edited) oommmggg how is it failing? i changed it to 50 shade variations and it still didn't work! ahhhhhhhhhhhhhh<{POST_SNAPBACK}>Maybe the colour your searching for is just flat out wrong.Is the colour of my text what you want to be looking for?Cus that's the colour you're giving to the function.I also attached a square sample of the colour it's looking for.*Edit: For clarification:3675204 = R-56, G-20, B-68 Edited March 6, 2005 by Saunders My AutoIt Stuff | My Github
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now