try this example mate
maybe its easier just to speak in code
rem ----------------------------------------------------------------------------
rem map data example
rem indi 3/19/2003
rem
rem ----------------------------------------------------------------------------
sync on
sync rate 0
randomize timer()
rem this is now global because its not made in the function
dim mapdata(5,5)
for x = 1 to 5
for y = 1 to 5
mapdata(x,y) = rnd(100)+1
next x
next y
REM Set height of matrix tiles useing the data blocks
For x = 1 To 5
For y = 1 To 5
Read height
mapdata(x,y) = height
Next x
Next y
Data 1,5,1,1,1
Data 0,5,0,2,0
Data 0,5,2,0,0
Data 0,5,0,0,4
Data 2,5,4,4,0
show_map_data()
save array "my_map.data",mapdata(0)
print " saved data press a key to continue"
suspend for key
for x = 1 to 5
for y = 1 to 5
mapdata(x,y) = 0
next x
next y
print " flushed data press a key to continue"
suspend for key
show_map_data()
load array "my_map.data",mapdata(0)
print " loaded data press a key to continue"
suspend for key
show_map_data()
undim mapdata(5,5)
end
function show_map_data()
for x = 1 to 5
for y = 1 to 5
print mapdata(x,y);" ";
next x
next y
print " printed data press a key to continue"
suspend for key
endfunction