best way to get data into a 3 dimensional array ?

BlitzMax Forums/BlitzMax Beginners Area/best way to get data into a 3 dimensional array ?

Dax Trajero(Posted 2006) [#1]
BlitzMax documentation is a little thin on the ground. Can someone suggest the best way to get data into a 3 dimensional array ?

The arrary data is fixed and will not ever change.
All array elements are of type integer

The x axis would contain 4 elements
The y axis would contain 32 elements
The z axis has 6 elements

Ideally I'd just have a table where I'd typed all the data in like this...

myarray[0,0,0]=12,14,10,15,17
myarray[0,1,0]=22,21,17,14,16

or, if BlitzMax has one, a series of consecutive DATA statements with a row of data in each?


smilertoo(Posted 2006) [#2]
i've found the fastest way is to create a databank, copy the data into it and write that to disk. Reverse the procedure to load it back in.


Dax Trajero(Posted 2006) [#3]
thanks

(scurries off to find out about databanks)


JazzieB(Posted 2006) [#4]
Seems like a lot of effort to use databanks! I would just use data statements and read them into the array with 3 For..Next loops when you initialise your game. You would need to do something like this to create your data file in the first place.

Lookup DefData, ReadData and RestoreData.


Dax Trajero(Posted 2006) [#5]
hmmm, just used DATA statements in a B3D program and imported them into BMAX and hey presto, I have a solution using DefData which I'll use to read into my array!


Dax Trajero(Posted 2006) [#6]
thanks JazzieB, I posted before I read your post! We came up with a similar solution - which I can say is working great.

Thanks all.