layer Posted November 3, 2004 Share Posted November 3, 2004 i get this error, whats wrong?: MouseClick ("left", $coord [0], $coord [1], 1, 0) Error: Subscript used with non-Array variable. heres the full code: HotKeySet("^!x", "MyExit") while 1 $coord = PixelSearch(0, 0, 724, 556, 0xBD9E4A, 0, 30) $coorda= PixelSearch(0, 0, 724, 556, 0x313018, 0, 25) If Not @error Then MouseClick ("left", $coord [0], $coord [1], 1, 0) MouseClick ("left", $coorda [0], $coorda [1], 1, 0) EndIf wend Func MyExit() Exit EndFunc help plz! FootbaG Link to comment Share on other sites More sharing options...
layer Posted November 3, 2004 Author Share Posted November 3, 2004 hehe, thank you, im sort of new, two weeks since i had it =D thank you larry! FootbaG Link to comment Share on other sites More sharing options...
layer Posted November 3, 2004 Author Share Posted November 3, 2004 wait a sec, im still getting the same error, heres the new code: HotKeySet("^!x", "MyExit") while 1 $coord = PixelSearch(0, 0, 724, 556, 0xBD9E4A, 0, 30) $coorda= PixelSearch(0, 0, 724, 556, 0x313018, 0, 25) If Not @error Then MouseClick ("left", $coord [0], $coord [1], 1, 0) MouseClick ("left", $coorda [0], $coorda [1], 1, 0) EndIf if @error then MouseClick ("left", $coord [0], $coord [1], 1, 0) MouseClick ("left", $coorda [0], $coorda [1], 1, 0) endif wend Func MyExit() Exit EndFunc whats wrong now!? FootbaG Link to comment Share on other sites More sharing options...
layer Posted November 3, 2004 Author Share Posted November 3, 2004 sry larry, i hate to bother you again =( but it still doesn't work, but when i get the error, it points to the "[0]" part, i don't know why, any other suggestions larry, thanks agaiN! =D FootbaG Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 3, 2004 Share Posted November 3, 2004 (edited) Maybe this will help: HotKeySet("^!x", "MyExit") while 1 $coord = PixelSearch(0, 0, 724, 556, 0xBD9E4A, 0, 30) $err = @error $coorda= PixelSearch(0, 0, 724, 556, 0x313018, 0, 25) If Not @error And Not $err Then msgbox(0,"",$coord) MouseClick ("left", $coord [0], $coord [1], 1, 0) MouseClick ("left", $coorda [0], $coorda [1], 1, 0) Else MsgBox(0,"Not Found", "Pixel Was Not Found On Screen") ExitLoop EndIf wend Func MyExit() Exit EndFunc The problem is your if logic still tries to access $coord and $coordA if they are NOT arrays. *** Matt @ MPCS Edited November 3, 2004 by Matt @ MPCS Link to comment Share on other sites More sharing options...
layer Posted November 3, 2004 Author Share Posted November 3, 2004 nice, it worked, but can i make it so that the loop keeps going, like if the pixel= not found then it will scan again? thank you both larry and matt! =D FootbaG Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 3, 2004 Share Posted November 3, 2004 This must be one of those too obvious solutions. Take out the ExitLoop after the else. You may also want to remove the MsgBox then also because it will show everytime the loop goes around. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
layer Posted November 3, 2004 Author Share Posted November 3, 2004 yikes! thank you, sorry for the obvious questions, but now i know! thanks again FootbaG Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 3, 2004 Share Posted November 3, 2004 Just so you know, you should probably take out the else statement also if you remove the exitloop and msgbox lines. Glad I could be of service! *** Matt @ MPCS Link to comment Share on other sites More sharing options...
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