Jump to content

Array variable has incorrect number of subscripts or subscript dimension range exceeded


Truong
 Share

Recommended Posts

Hi all, I'm a newbee here, and I have a little problem with my program:

The problem occurs in line 69 and 70, if I make the only the line 69 work, it works. If I make line 70 work together with line 69, it says Array variable has incorrect number of subscripts or subscript dimension range exceeded, even they are the copy of each other! And I've tried my best but I could not figure it out!

Thanks for any reply ^^, and it's up to 200 lines both 2 files.

Boot.au3

TBG.au3

http://www.facebook.com/xx3004?sk=info

Link to comment
Share on other sites

Welcolme to the forum !There is a problem in the g function

it want return a $temp[3] but UBound ( $temp ) -1 = 1

Func g($type,$currentUse, $num);
    $temp=StringSplit(d(IniRead(@ScriptDir&"\dsm\inv_"&$type&".inv", $uID, $currentUse, "Error")), "#");
    ConsoleWrite ( "UBound ( $temp ) -1 : " & UBound ( $temp ) -1 & @Crlf )
    ConsoleWrite ( "$num : " & $num & @Crlf )
    Return $temp[$num];
EndFunc
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Welcolme to the forum !There is a problem in the g function

it want return a $temp[3] but UBound ( $temp ) -1 = 1

Func g($type,$currentUse, $num);
    $temp=StringSplit(d(IniRead(@ScriptDir&"\dsm\inv_"&$type&".inv", $uID, $currentUse, "Error")), "#");
    ConsoleWrite ( "UBound ( $temp ) -1 : " & UBound ( $temp ) -1 & @Crlf )
    ConsoleWrite ( "$num : " & $num & @Crlf )
    Return $temp[$num];
EndFunc

Hi bro, fist, thanks for your help.

I've tried, and it make another error:

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 9

$num : 3

UBound ( $temp ) -1 : 1

$num : 4

C:\Users\Guest\Desktop\Work\TBG.au3 (46) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Return $temp[$num]

Return ^ ERROR

Could you please help me figure it out!

Thanks in advanced!

http://www.facebook.com/xx3004?sk=info

Link to comment
Share on other sites

Rewrite your code by splitting multi compound code lines into there separate parts.

So you can debug (ConsoleWrite) the process better.

$temp=StringSplit(d(IniRead(@ScriptDir&"\dsm\inv_"&$type&".inv", $uID, $currentUse, "Error")), "#")

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Rewrite your code by splitting multi compound code lines into there separate parts.

So you can debug (ConsoleWrite) the process better.

$temp=StringSplit(d(IniRead(@ScriptDir&"\dsm\inv_"&$type&".inv", $uID, $currentUse, "Error")), "#")

Hi bro, I don't get what you mean, that line works ;)

http://www.facebook.com/xx3004?sk=info

Link to comment
Share on other sites

"I've tried, and it make another error:"

You main its not that g() function thats giving you a additional problem?

In that case, my bad.

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Another game automation case - obvious enough when you look into attached files:

IniWrite(@ScriptDir&"\dsm\inv_vk.inv", $fID, 1, e("b.jpg#Stone Hammer#25#5#5#5#5#0#50"));

IniWrite(@ScriptDir&"\dsm\inv_kh.inv", $fID, 1, e("nud.jpg#Wooden Shield#5#10#5#5#5#2#0"));

IniWrite(@ScriptDir&"\dsm\inv_ar.inv", $fID, 1, e("nud.jpg#Wooden Armor#5#10#5#5#5#2#0"));

IniWrite(@ScriptDir&"\dsm\inv_hm.inv", $fID, 1, e("nud.jpg#Wooden Helmet#5#10#5#5#5#2#0"));

IniWrite(@ScriptDir&"\dsm\inv_r1.inv", $fID, 1, e("nud.jpg#Ring of Luck#5#5#5#10#5#0#0"));

IniWrite(@ScriptDir&"\dsm\inv_r2.inv", $fID, 1, e("nud.jpg#Ring of Intelligence#5#5#5#5#10#0#0"));

IniWrite(@ScriptDir&"\dsm\inv_aml.inv", $fID, 1, e("nud.jpg#Pendent of power#10#5#5#5#10#0#0"));

You might be aware that game automation is not tolerated here - if you didn't know - read the enouncement http://www.autoitscript.com/forum/index.php?showannouncement=12&f=2 ...

But I have a "gut feeling" that you already knew about that ...

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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