Sign in to follow this  
Followers 0
Esamu

Array problem

5 posts in this topic

Okay guys, I didn't work with AutoIt for like a year or so, and wanted to try something again.

But I ran into a problem with some arrays I'm using.

First of all, the purpose of this script is to read some data out of a group of programs and save the data into an array.

You can find the whole code at http://pastie.org/1490367, but I'll try to give you only the snippets you need to.

$iBotList=WinList('[CLASS:ThunderRT6FormDC]')
    If $iBotList[0][0] = 0 Then
        MsgBox(0, "Error", "No iBot found. Closing...")
        Exit 1
    EndIf
    #Region - Dim data variables
    Dim $CHAR[$iBotList[0][0]]
    Dim $LVL[$iBotList[0][0]]
    Dim $GOLD[$iBotList[0][0]]
    Dim $SP[$iBotList[0][0]]
    Dim $EXP[$iBotList[0][0]]
    Dim $KILLSMIN[$iBotList[0][0]]
    Dim $KILLSTOTAL[$iBotList[0][0]]
    Dim $XPMIN[$iBotList[0][0]]
    Dim $XPTOTAL[$iBotList[0][0]]
    Dim $SPMIN[$iBotList[0][0]]
    Dim $SPTOTAL[$iBotList[0][0]]
    Dim $ITEMPICK[$iBotList[0][0]]
    Dim $DEATHS[$iBotList[0][0]]
    Dim $TOTALDCS[$iBotList[0][0]]
[...]
    For $i = 1 to $iBotList[0][0]
        #Region - Reading data from bots
        $HANDLE = $iBotList[$i][1]
        $CHAR[$i] = ControlGetText($HANDLE, "", "[CLASS:" & $LABELCLASS & ";INSTANCE:" & $INSTANCE_CHAR & "]")
        $LVL[$i] = ControlGetText($HANDLE, "", "[CLASS:" & $LABELCLASS & ";INSTANCE:" & $INSTANCE_LVL & "]")
        $GOLD[$i] = ControlGetText($HANDLE, "", "[CLASS:" & $LABELCLASS & ";INSTANCE:" & $INSTANCE_GOLD & "]")
[...]

Right, my problem is, when running the script, I get this error:

E:\Development\WebStatistics.au3 (66) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$CHAR[$i] = ControlGetText($HANDLE, "", "[CLASS:" & $LABELCLASS & ";INSTANCE:" & $INSTANCE_CHAR & "]")

^ ERROR

>Exit code: 1 Time: 1.618

I already read about the error, the array is somehow invalid dimensioned, but why? I don't get it :/

Thanks in advance

Share this post


Link to post
Share on other sites



It's a program to make a web statistic of a game bot, not to automate a game :) I read the rules.

And your solution worked, thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0