Jump to content

Subscript used with non-Array variable


 Share

Recommended Posts

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
Wend

The program still works though...

I'd still want to fix this little bug.

Thanks

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 by Tvern
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...