Reizvoller Posted April 7, 2016 Posted April 7, 2016 Hello! So I have a little script here Func getThe () Local $nearPix = 0123 Local $winPos = WinGetPos ($workWin) FFSaveBMP ("yBarPosArea", "True" , 600, 239, 600, 555, 30, $workWin) $nearPix = FFNearestPixel (600, 220, "0xC1C1C1" , False, $workWin) If $nearPix == 0123 Then ConsoleWrite ("No val for NearPix") ElseIf $nearPix <> 0123 Then ConsoleWrite ("Val is there") ConsoleWrite ($nearPix[0]&","&$nearPix[1]&@CR) EndIf EndFunc And when it comes time to run it I get a return of Quote (11) : ==> Subscript used on non-accessible variable.: ConsoleWrite ($nearPix[0]&","&$nearPix[1]&@CR) ConsoleWrite ($nearPix^ ERROR When it says "non-accessible variable" , what is it meaning by that? The scope is "Local" and it is within the same function. The variable was even referenced in the step right before the one throwing the error. Any insight would be thoroughly appreciated. Thank you!
Moderators JLogan3o13 Posted April 7, 2016 Moderators Posted April 7, 2016 @Reizvoller it is telling you that $nearPix[0] does not exist. It appears you are expecting $nearPix to be an array of values; have you tried inserting an _Arraydisplay, or IsArray for debugging purposes? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Reizvoller Posted April 7, 2016 Author Posted April 7, 2016 (edited) Greetings JLogan, IsArray escaped my memory and it has returned with "Not an array" in my little script Func getThe () Local $nearPix = 0123 Local $winPos = WinGetPos ($workWin) FFSaveBMP ("yBarPosArea", "True" , 600, 239, 600, 555, 30, $workWin) $nearPix = FFNearestPixel (600, 220, "0xC1C1C1" , False, $workWin) If $nearPix == 0123 Then ConsoleWrite ("No val for NearPix") ElseIf $nearPix <> 0123 Then ConsoleWrite ("Val is there") Local $arrayCheck = IsArray ($nearPix) If $arrayCheck = 0 Then ConsoleWrite ("Not an array") ElseIf $arrayCheck = 1 Then ConsoleWrite ($nearPix[0]&","&$nearPix[1]&@CR) EndIf EndIf EndFunc That's the script as it stands now, did I employ the "IsArray" appropriately in your opinion? I am going to dig around at my FFNearestPixel function as it isn't giving me the array return I am hoping for... Your debugging reminder was very valuable at the very least. Thank you again. Edited April 7, 2016 by Reizvoller Error in my script
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