Data statements and arrays are really useful. You can store all kind of attributes in arrays, and data statements are easy ways to put lots of data into arrays.
Here are two examples, one uses a 2 dimensional array as a heightmap, the dimensions being x and y, all the heights are put into data statements, read off and then the matrix heights are set using them. The other example uses a 2 dimensional array, one dimension being the object index, and the other dimension being the coordinates.
sync on
sync rate 30
hide mouse
autocam off
make matrix 1,2000,2000,10,10
rem Put all the height data into data statements
dim terrain(10,10)
data 1,2,6,9,4,8,6,4,2,1
data 4,0,0,0,0,0,0,0,0,4
data 3,0,0,9,9,9,9,0,0,8
data 2,0,0,9,0,0,0,0,0,2
data 4,0,0,9,0,0,0,0,0,4
data 8,0,0,9,9,9,0,0,0,9
data 4,0,0,9,0,0,0,0,0,2
data 2,0,0,9,0,0,0,0,0,3
data 3,0,0,0,0,0,0,0,0,9
data 6,9,1,3,5,2,2,4,9,9
for i=0 to 9
for j=0 to 9
rem Read off all the height data and apply it to the matrix
read terrain(i,j)
set matrix height 1,j,9-i,terrain(i,j)*20
rem Notice how I use small numbers in the data statements
rem to avoid confusion, and scale them up later
next j
next i
update matrix 1
rem Put the x y and z coordinates of shapes into data statements
dim positions(10,3)
data 1,1,7
data 6,-3,3
data 2,2,8
data 7,1,2
data 2,2,6
data 8,-2,1
data 5,3,2
data 7,-1,6
data 4,2,5
data 1,3,2
for i=0 to 9
read positions(i,0)
read positions(i,1)
read positions(i,2)
make object sphere i+1,200
rem Position each object according to the data in the array
position object i+1,positions(i,0)*200,positions(i,1)*200,positions(i,2)*200
next i
do
`a#=wrapvalue(a#+mousemovex())
a#=wrapvalue(a#+1)
position camera 1000+(sin(a#)*1000),400,1000+(cos(a#)*1000)
point camera 1000,0,1000
sync
loop