[22 Nov 2007] Dim "problem"

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
Andrea

[22 Nov 2007] Dim "problem"

Post by Andrea »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 22 Nov 2007 11:25:03 +0100

i have a little problem with the "Dim" command

here a snap of my code

Code: Select all

Global MAXPARTICLES = 50000
Dim partarray[MAXPARTICLES+1]
the compiler tells me i must enter a value into the parameter of dim

so it's not possible to inizialize an array with a variable argument?

i can initialize it with the while-whend cycle, but the Dim option is much easy :D
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[22 Nov 2007] Re: Dim "problem"

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 22 Nov 2007 12:25:12 +0100

you could try to use dim with a constant. not with a calc. so dim array[MAXPATICLES] should work...
Andrea

[22 Nov 2007] Re: Dim "problem"

Post by Andrea »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 22 Nov 2007 14:15:43 +0100
you could try to use dim with a constant. not with a calc. so dim array[MAXPATICLES] should work...
unfortunatly not :(

Code: Select all

c = MAXPATICLES+1
dim array[c]
and not with this too :(
User avatar
airsoftsoftwair
Posts: 5832
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[23 Nov 2007] Re: Dim "problem"

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 23 Nov 2007 15:05:54 +0100
i have a little problem with the "Dim" command

here a snap of my code

Global MAXPARTICLES = 50000 Dim partarray[MAXPARTICLES+1]

the compiler tells me i must enter a value into the parameter of dim

so it's not possible to inizialize an array with a variable argument?
Currently not.
i can initialize it with the while-whend cycle, but the Dim option is much easy :D
Well, initializing the array using a loop is also pretty straight forward, i.e.

Code: Select all

; make a new array
partarray = {}

; initialize fields 0-50000 with 0
For Local k = 0 To MAXPARTICLES Do partarray[k] = 0
Locked