Mega99 Posted August 13, 2009 Posted August 13, 2009 Ok so I am currently trying to make a bot that will play this game by itself.The game consists of jumping up with a mouse click, hitting a object that will make you go up higher, and so on.To move the jumping person, you just move the mouse.I use PixelSearch to find the the bells (on which you jump on), and then MouseMove to get move the mouse.Unfortunatly, SciTE is giving me a error: Subscript used with non-Array variable.:Global $coor[2] sleep(2000) $coor=PixelSearch(2298, 400, 2981, 525, 0xC6D6E3, 10, 1 ) MsgBox(0,"try",IsArray($coor)) While @error=0 if not @error then $coor = PixelSearch(2298, 360, 2981, 485, 0xC6D6E3, 10, 1 ) MouseMove($coor[0], $coor[1], 2) Sleep(350) EndIf WendThe program still works though...I'd still want to fix this little bug.Thanks
Authenticity Posted August 13, 2009 Posted August 13, 2009 So change the loop logic because you'll need to call IsArray() or check if there is an @error: $coor=PixelSearch(2298, 400, 2981, 525, 0xC6D6E3, 10, 1 ) If @error = 0 Then Do MouseMove($coor[0], $coor[1], 2) Sleep(350) $coor = PixelSearch(2298, 360, 2981, 485, 0xC6D6E3, 10, 1 ) Until @error EndIf
jvanegmond Posted August 14, 2009 Posted August 14, 2009 The only problem with the original script was that you forgot to check for errors on the second PixelSearch. Global $coor[2] sleep(2000) $coor=PixelSearch(2298, 400, 2981, 525, 0xC6D6E3, 10, 1 ) MsgBox(0,"try",IsArray($coor)) While @error=0 ; <== A proper check for errors if not @error then $coor = PixelSearch(2298, 360, 2981, 485, 0xC6D6E3, 10, 1 ) MouseMove($coor[0], $coor[1], 2) ; <== No check for error Sleep(350) EndIf Wend github.com/jvanegmond
Tvern Posted August 14, 2009 Posted August 14, 2009 (edited) The only problem with the original script was that you forgot to check for errors on the second PixelSearch.Well that, and the first error check seems to be checking if the MsgBox() returned an error, rather then the PixelSearch(). Edited August 14, 2009 by Tvern
jvanegmond Posted August 14, 2009 Posted August 14, 2009 (edited) Well that, and the first error check seems to be checking if the MsgBox() returned an error, rather then the PixelSearch().True, or IsArray... Maybe. Edited August 14, 2009 by Manadar github.com/jvanegmond
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