Page 1 of 1

[22 Nov 2007] Dim "problem"

Posted: Sat Jun 13, 2020 5:31 pm
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

[22 Nov 2007] Re: Dim "problem"

Posted: Sat Jun 13, 2020 5:31 pm
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...

[22 Nov 2007] Re: Dim "problem"

Posted: Sat Jun 13, 2020 5:31 pm
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 :(

[23 Nov 2007] Re: Dim "problem"

Posted: Sat Jun 13, 2020 5:31 pm
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