2011-02-22, 06:02 PM
How do I create an array with an integer instead of a literal number?
I want to do this:
instead of:
just in case I decide to change my mind about the number of persons
I want to do this:
Code:
DIM personX (numPersons) as ubyte
DIM personY (numPersons) as ubyte
DIM personHealth (numPersons) as ubyte
DIM personWeapon (numPersons) as ubyteinstead of:
Code:
DIM personX (6) as ubyte
DIM personY (6) as ubyte
DIM personHealth (6) as ubyte
DIM personWeapon (6) as ubyte

This is a feature planned for 1.2.8 (or higher). Dynamic array are a bit trickier, slower and might take a little more memory, but on the other hand are more powerful and allow redimension during runtime. Meanwhile, you can create an array with a MAXPERSONS size (e.g. 20), and use a variable to store the real number of persons: