erifash Posted April 3, 2005 Share Posted April 3, 2005 (edited) Hi again! I've been having serious issues with Dim. See, I have a variable and I don't know what it is and I need to use that variable to specify the length of an array. Only it says "Array variable subscript badly formatted." Here is the code: Dim $a[Int($b + 1)] I want to do that so I wouldn't have to do... Dim $a[1001] ...and use up resources and hope that when i'm writing to the array that $b doesn't exceed 1000. Help! Edited April 3, 2005 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
Ejoc Posted April 3, 2005 Share Posted April 3, 2005 (edited) assuming $b has been defined already: Dim $a[$b+1] actually your version should work too. therefore $b is not a number Edited April 3, 2005 by Ejoc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
erifash Posted April 3, 2005 Author Share Posted April 3, 2005 (edited) Yes, but $b is a decimal like 3.14159265 (not pi though, just example) so that's why I thought it being a non-interger screwed it up so I made it and interger by using Int(). Also, it still doesn't work... (see screenshot) Edited April 3, 2005 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
Ejoc Posted April 3, 2005 Share Posted April 3, 2005 (edited) its your $b This runs: $b = 3.14159 Dim $a[int($b+1)] $a[int($b)] = "hi" msgbox(0,"",$a[int($b)]) EDIT If your $b <= -1 it will break like it is for you, you probably need to add: int(abs($+1) Edited April 3, 2005 by Ejoc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
erifash Posted April 3, 2005 Author Share Posted April 3, 2005 yup, that works perfect! thanks! My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now