|
Post by davy on Aug 3, 2006 11:40:34 GMT -5
Oh... You want to WRITE to a file... You have to open it different to write. Here is how thats done...
This will write the value of x on the first line of the file, and the value of y on the second line...
dim x,y dim outfile outfile=openfileWRITE("Test.txt") x=5 y=20 Writeline(outfile, x) Writeline(outfile, y) closefile(outfile)
Once you have written to the file, you may read from it... This will make x equal the first line of the file, and y equal the second line... So, since we save x to the first line, and y to the second line, this will recover our x and y positions!
dim x,y dim infile infile=openfileREAD("Test.txt") x=val(READline(infile)) y=val(READline(infile)) closefile(infile) printr x printr y
|
|
|
Post by James :) (aka Madcow) on Aug 4, 2006 17:48:12 GMT -5
to read level data just read x osize of the level and y size then read
it like this
dim if dim x,i,j dim y dim m if = openfileread("file.txt") x = val(readline(if)) y = val(readline(if)) for i=1 to y m=0 for j=1 to x m=m+1 if m=1 then execute(compile("data,"+readline(if)) else execute(compile(","+readline(if)) endif next clsoefile(if)
|
|