Jump to content

Error: array variable has incorrect number of subscripts or subscript dimension range exceeded When i try to use cmdline


Recommended Posts

Help i get this error whenever i try using cmdline for my program

#include "../IncludeAll.au3"

Dim $CmdLine[1]

Local $SupportedOses[3] = ["WIN_2012R2","WIN_2012","WIN_2008R2"]

If @OSVersion == $SupportedOses[1] Then
    If $CmdLine[0] > 0 Then
        If $CmdLine[1] == "" Then
            ConsoleWriteError("Startservice failed. Try using -test to see if rssc works")
            Sleep("5000")
            _exit()
        ElseIf $CmdLine[1] == "-test" Then
            ConsoleWriteError("Test complete")
            Loadgraphics("296", "306", "Renderer", "")
            Sleep("5000")
            _exit()
        EndIf
    Else
        ConsoleWriteError("Startservice failed. Try using -test to see if rssc works")
        Sleep("500")
    EndIf
Else
    ConsoleWriteError("Bricks online server only works with " & $SupportedOses[1])
    Sleep("500")
    Exit
EndIf

 

Capture.PNG

Link to post
Share on other sites
  • Developers
Posted (edited)

Why do you have this line?

Dim $CmdLine[1]

This is an internal provided array.....

And......arrays are 0 based!

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

i dont think it is in include all

;Main includes
#include <File.au3>
#include <WinAPIFiles.au3>
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <Date.au3>
#include <au3Irr2_Constants.au3>
#include <au3Irr2_System.au3>
#include <au3Irr2_KeyboardMouse.au3>
#include <au3Irr2_FilingSystem.au3>
#include <au3Irr2_2D.au3>
#include <au3Irr2_Materials.au3>
#include <au3Irr2_Scene.au3>
#include <au3Irr2_Node.au3>
#include <au3Irr2_Animation.au3>
#include <au3Irr2_Collision.au3>
#include <au3Irr2_Camera.au3>
#include <au3Irr2_Lighting.au3>
#include <au3Irr2_Terrain.au3>
#include <au3Irr2_Particles.au3>
#include <au3Irr2_GUI.au3>
#include <Zip.au3>

 

Link to post
Share on other sites
  • Developers
8 hours ago, Seeseehu said:

I added that line as an attempt to fix that error. t

Fine, so post an correct and runnable script without all the extra's , and provide the commandline parameters to start it with to cause the error.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

I'd like to suggest to run your script from SciTE Editor and then take a look at the output: It will show you the line causing the "dimension range exceeded" error and the array variable, that was addressed.

This sample code might help you to see, what's going wrong:

 

Dim $ArrayGivingTrouble[3][4][5]

$Dimensions=UBound($ArrayGivingTrouble,0)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Dimensions = ' & $Dimensions & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

for $d = 1 to $Dimensions
    ConsoleWrite("Ubound for Dimension " & $d & " = " & UBound($ArrayGivingTrouble,$d) & @CRLF)
Next

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to post
Share on other sites
  • Developers
Posted (edited)

No need for an attachment, just use a codebox, but this file looks exactly the same as the earlier posted code and that obviously doesn't work for me as I do not have you include file(s). ;) 

One needs to be able to run the script to be able to debug. You could start yourself with running it form SciTE so it tells you exactly which line is causing it.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
18 hours ago, Jos said:

No need for an attachment, just use a codebox, but this file looks exactly the same as the earlier posted code and that obviously doesn't work for me as I do not have you include file(s). ;) 

One needs to be able to run the script to be able to debug. You could start yourself with running it form SciTE so it tells you exactly which line is causing it.

Yo i removed zip.au3 from includeall and it fixed the issue, idk why a zip udf would get in the way of cmdline tbh tho

Link to post
Share on other sites

@Seeseehu

Nice, that you were able to fix your issue.

 

Not that nice, that you ignored all answer postings and didn't provide any of the information, you have been asked for.

 

Never mind ...

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...