Reizvoller Posted April 1, 2016 Posted April 1, 2016 Greetings, Func pixelHunter () Local $PixelHunt[2] Do $PixelHunt = PixelSearch (1, 1, 1016, 874, "0xCCE4CC", 0, 1, $sWorkOrderWin) Until $PixelHunt[0] > 0 EndFunc So when I call up this function in my app it fires back "Subscript used on non-accessible variable" Now, if I am understanding this message properly it is trying to tell me that the variable can't be seen by the function asking for it. I replaced "Do...Until" with simply a "ConsoleWrite" the $PixelHunt value and it doesn't throw that error. Any advice would be appreciated! -Reiz
markyrocks Posted April 1, 2016 Posted April 1, 2016 (edited) Pixelsearch returns an array. $pixel hunt does not need to be declared as an array ahead of time remove the "[2]" from the declaration line. Remove the do and until statement. It should look like this $a=pixelsearch (0,0,100,100, color) If isarray ($a) then ;do whatever bc it was successful Else ; do whatever not successful no color found Endif Your basically declaring an array $pixelhunt [0] $pixelhunt [1] $pixelhunt [2] Then trying to assign a value to an unknown slot. If you went $pixelhunt [0]=pixelsearch (0,0,1,1,color) the return would (should ,could?) Be stored as $pixelhunt [0][0]=x coord $pixelhunt [0][1]=y coord I believe it would work this way. It's been awhile. Edited April 1, 2016 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning"
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