Posted: 9th Jan 2004 00:32
okay, I've done this many time with qbasic 4.5 -> and liberty basic. But I can't seem to do it with dbasic. I thought it would be just as simple, but I guess not.
I simple want a text file to look like an array, like this:
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1
something like that, except 100*100.
Shouldn't putting an array into a text file like that work like this?
open to write 1,"level.map"
for y = 1 to ysize
for x = 1 to xsize
write string 1,str$(map(x,y))
next x
next y
close file 1
but that simply outputs a text file which looks like this
0
0
1
0
1
1
1
0
0
1
etc.
and all the other options (float,word,long,etc.) just give me funny symbols. Isn't there an easy, straight forward way to do this? It's just a simple way to read and write maps.
Thanks.