Jump to content

Trouble With Arrays


Guest TheComputerMutt
 Share

Recommended Posts

Guest TheComputerMutt

Ok, not a complete Newb, but I never seem to have gotten the hang of arrays in AutoIt, and I'm having some trouble. Posted Image

The code that's causing the error...

;Declaring the positions of the tiles
Dim $TilePosX[10][10]
Dim $TilePosY[10][10]
For $XLoop = 1 to 10
    For $YLoop = 1 to 10
        $TilePosX[$XLoop][$YLoop] = 15 + (16 * ($XLoop - 1))
        $TilePosY[$XLoop][$YLoop] = 104 + (16 * ($YLoop - 1))
    Next
Next
The error...

Posted Image

What am I doing wrong?

And in case you're wondering, I'm making a bot to play MineSweeper. Not that it matters, just for something to do. You know, for fun. :)

Wait... are those arrays only from 0 to 9? I mean, that's not the error (I changed the loop to that and still got the error), but mightn't that cause another error?

-TCM

Link to comment
Share on other sites

Guest TheComputerMutt

An array of 10 elements means element 0 - 9

For $XLoop = 0 to 9

<{POST_SNAPBACK}>

You know what? I tried that before I posted, and it didn't work. What I didn't realize, is that I only fixed one of the loops. :)

Thanks for helping me regain my common sense. It works now.

-TCM

Link to comment
Share on other sites

An array of 10 elements means element 0 - 9

For $XLoop = 0 to 9

<{POST_SNAPBACK}>

Larry, please correct me if I'm wrong. I though and an array of 10 elements was 1 - 10, whith 0 being a the total count of elements in the array. Maybe it only works that way for a StingSplit().

Anyway, please let me know.

Thanks,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Guest TheComputerMutt

No, it's not real. :) I crossposted this from another board, and there I have the reputation of photoshopping all my uploads, most of the time with this gradient. :) I wish it were real though...

-TCM

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...