Sign in to follow this  
Followers 0
Paedric

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

10 posts in this topic

Hello.

I have a script that gives this error.

[color=#616375][font=Helvetica, Verdana][size=3][background=rgb(250, 247, 244)]Line 6918 (File"C:\program files (x86)\Steam\Steamapps\common\rome total war gold\launcher\Rome Total Ralism VII.exe"):[/background][/size][/font][/color]

[color=#616375][font=Helvetica, Verdana][size=3][background=rgb(250, 247, 244)]Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.[/background][/size][/font][/color]

The problem is that only a few people have this error. (I don't, so I can't reproduce it)

Also, it's with the compiled exe, so I believe the line number gives refers to that, and not the source code. (My script only has around 700 lines.)

Is there something I can do to debug it?

The error deals with array, so I have checked them, but could see nothing wrong. What should I look for in particular for this kind of error?

Thanks. :)

Share this post


Link to post
Share on other sites



You have an array in your script (e.g. $Array[10] with 10 elements). As the numbering starts with 0 you have to access them from $Array[0] to $Array[9]. If you try $Array[10] you will see the mentioned error.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It gives the correct line, however when you compile your script you merge all files into one, with includes being at the top, and yours at the bottom. You can calculate the line by adding includes etc. If you used obfuscator, you also wanna factor in that it could replace constants.


Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG

Share this post


Link to post
Share on other sites

Not 100% true. Comments will be removed even when obfuscator is not used.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I had checked for that.

However, I have something like that.

Global $EntriesLine[999]
_FileReadToArray("..FOE.svnentries", $EntriesLine)
$CurrentRevision = $EntriesLine[4]

Could it give that kind of error if there more than 999 lines?

It shouldn't be more than ~400 lines long, but I guess writing something like that would be safer.

Global $EntriesLine
_FileReadToArray("..FOE.svnentries", $EntriesLine)
$CurrentRevision = $EntriesLine[4]

@Shaggi, thanks, I'll count.

Edited by Paedric

Share this post


Link to post
Share on other sites

_FileReadToArray sizes the array to its needs. But how do you access the elements of the array? Can you post this code snippet?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Only with the third line, that's it.

$CurrentRevision = $EntriesLine[4]

Could it be that there isn't enough lines though? If the file is empty, would it do that kind of error.

The only other thing that use an array is this.

Func _Start_steam($mod)
$SteamPath = RegRead("HKEY_LOCAL_MACHINESOFTWAREWow6432NodeValveSteam", "InstallPath")
If Not @error = 0 Then
MsgBox(0, "Steam Launcher - Error", "Failed to find Steam." & @CRLF & "Are you sure you have to use Steam in order to play Rome Total War?")
Else

Global $SteamBatchFileContent[13] ; 12 strings and 0 not used

Global $SteamUserName = IniRead(@ScriptDir & "" & $iniFile, $defaultIniSection, $UserNameIniKey, "")



$SteamBatchFileContent[1] = "set SteamAppId=4760"
$SteamBatchFileContent[2] = "set SteamAppUser=" & StringLower($SteamUserName)
$SteamBatchFileContent[3] = "set SteamAppVersionId=0"
$SteamBatchFileContent[4] = "set SteamPath=" & $SteamPath
$SteamBatchFileContent[5] = "set SteamUser=" & StringLower($SteamUserName)
$SteamBatchFileContent[6] = "set suppress_restart=1"
$SteamBatchFileContent[7] = "set ValvePlatformMutex=" & $SteamPath & "steam.exe"
$SteamBatchFileContent[8] = "set __STEAM_BOOTSTRAPPER_ICON_ID__=128"
$SteamBatchFileContent[9] = ""
$SteamBatchFileContent[10] = "set PATH=%SteamPath%;%PATH%"
$SteamBatchFileContent[11] = ""
$SteamBatchFileContent[12] = @ComSpec & " /c " & "start /affinity 1 /high " & "RomeTW-BI.exe" & $mod & " " & $cmdLineParams


; Delete any existing batch file and wait until it's gone.
If FileExists($SteamBatchFilePath) = 1 Then FileDelete($SteamBatchFilePath)

Sleep(250)

Local $Stop = 1
Do
$Stop = FileExists($SteamBatchFilePath)
Until $Stop = 0

; Create the batch file and wait until it's finished.
_FileWriteFromArray($SteamBatchFilePath, $SteamBatchFileContent)

Local $Stop = 0
Do
$Stop = FileExists($SteamBatchFilePath)
Until $Stop = 1

EndIf

If Run($SteamBatchFilePath) = 0 Then
MsgBox(0, "Steam Launcher - Error", "Failed to run SteamLauncher.bat.")
EndIf

EndFunc ;==>_Start_steam
Edited by Paedric

Share this post


Link to post
Share on other sites

Paedric,

This looks to me very much like a script to launch the Rome Total War game on Steam. Have you read the Forum Rules? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Indeed, this is a mod launcher for Rome Total War.

The mod in question is RTRVII (http://www.twcenter.net/forums/forumdisplay.php?f=26), though I have created one for Roma Surrectum II(http://www.twcenter.net/forums/forumdisplay.php?f=251) which is quite similar.

If I read the rules correctly, what is banned is bot and other illegals thing.

The launcher simply start the game with the correct arguments, so users don't have to create a new shortcut each time.

Mods in RTW can be launched by adding -mod:my_mod_folder in the target of the shortcut, the script does that automatically, in this case for Steam.

I wasn't aware that it was something that was banned on those forums, but if it is an issue, you can close/delete this thread.

If you want to check it, I can also give you the whole source file.

Sorry for the troubles.

Share this post


Link to post
Share on other sites

Peadric,

If I read the rules correctly, what is banned is bot and other illegals thing

It seems you did not read them very well: ;)

"Any discussion of using AutoIt to launch or interact with a game or game server violates our rules

So I am afraid that your script does fall into the prohibited category and this thread will now be locked. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0