here, i threw this together for you real quick...(it reminded me of something in C++...namely the getline function...)
this would do what you are saying for whatever size you want...
sync on `Standard setup
sync rate 0
global xsize = 10 `these can be whatever size the file stores
global ysize = 10 `Note: these are the number of data pieces between the commas...not the total number of characters in the line...so for example "22,4,5" would have a width of 3
dim mdata(xsize,ysize) `make a 10 by 10 array to store the data in
rstring as string `used to store what's in the current line of the file
rstring2 as string `used to store what's going to be in the current array index
open to read 1,"stuff.txt" `open the file
for y = 1 to ysize `we are going to loop through all the different rows of data
read string 1,rstring `Read the current row's data all into one string
i = 0 `Set this to zero so we don't try to start reading at the end of the row!
for x = 1 to xsize `now we loop until we've loaded in the right number of data pieces... you could set this number to lower than the actual amount in the file...then it would just ignore anything beyond that number
rstring2 = "" `throw away the last data piece so we can start with a blank
done = 0 `set the flag variable for the loop to 'false' so we don't skip the important part!
while done = 0 `start the loop and end it when done = 1
inc i `increment this variable so we can loop through the row
if len(rstring) > (i-1) `do we still have string left to read?
if mid$(rstring,i) = "," `are we at a comma?
done = 1 `if we are then this data piece is done
else `if we aren't
rstring2 = rstring2 + mid$(rstring,i) `then we add to the temporary string 'rstring2' the value of the current character
endif
else `if we are at the end of the row
done = 1 `then we are done
endif
endwhile
mdata(x,y) = val(rstring2) `load all the the data piece into the array... note: we can put multiple digit numbers in-between the commas and it will still read them into the array...so you could do something like "1,100,27,42,17,4500,7000,2,87,100"
next x `start a new reading loop
next y `go to the next column
close file 1 `close the file
do
`this is just printing it to the screen
`note: if you put larger numbers into the file they wouldn't print out nicely using this routine
`because the spacing is 20 pixels and if you had bigger numbers they would over lap...
for y = 1 to ysize
for x = 1 to xsize
text x*20,y*20,str$(mdata(x,y))
next x
next y
sync
loop
try running that with a txt file called "stuff.txt" with the below contents...
2,1,1,1,1,1,1,1,1,3
1,2,1,1,1,1,1,1,3,1
1,1,2,1,1,1,1,3,1,1
1,1,1,2,1,1,3,1,1,1
4,1,1,1,2,3,1,1,1,5
4,1,1,1,3,2,1,1,1,5
1,1,1,3,1,1,2,1,1,1
1,1,3,1,1,1,1,2,1,1
1,3,1,1,1,1,1,1,2,1
3,1,1,1,1,1,1,1,1,2
hope it works for you, i tried to comment heavily to make it was understandable...
--Peter
"We make the worst games in the universe."