Paedric Posted July 8, 2012 Share Posted July 8, 2012 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. Link to comment Share on other sites More sharing options...
water Posted July 8, 2012 Share Posted July 8, 2012 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Shaggi Posted July 8, 2012 Share Posted July 8, 2012 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 Link to comment Share on other sites More sharing options...
water Posted July 8, 2012 Share Posted July 8, 2012 Not 100% true. Comments will be removed even when obfuscator is not used. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Paedric Posted July 8, 2012 Author Share Posted July 8, 2012 (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 July 8, 2012 by Paedric Link to comment Share on other sites More sharing options...
water Posted July 8, 2012 Share Posted July 8, 2012 _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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Paedric Posted July 8, 2012 Author Share Posted July 8, 2012 (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.expandcollapse popupFunc _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 July 8, 2012 by Paedric Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 8, 2012 Moderators Share Posted July 8, 2012 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? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Paedric Posted July 8, 2012 Author Share Posted July 8, 2012 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. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 8, 2012 Moderators Share Posted July 8, 2012 Peadric,If I read the rules correctly, what is banned is bot and other illegals thingIt 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 rulesSo I am afraid that your script does fall into the prohibited category and this thread will now be locked. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts