I'm planning for all my maps to be the same size, but I'll definitely keep this in mind.Is the map height and width the same for all map files?
You could just use the "file_text_eoln/eof" commands. This would allow that map to be any size and not need a preset size.
Thank you, this works much better! (read: at all) Now I'm faced with a different problem. There is a column of zeroes inserted on the left of the array (map[0,X]). Is this something to do with newlines, maybe? /shrugRead strings and process them, instead of reading reals. For each string read, file_text_readln() to get to the next line. For getting a one-line string into your array, you can use a combination of real() and string_char_at().
if file_exists("map.txt"){
var nFile;
var nString;
nFile = file_text_open_read("map.txt");
for (i = 0; i < MAP_HEIGHT; i += 1){
nString = file_text_read_string(nFile);
for (n = 0; n < MAP_WIDTH; n += 1){
map[n,i] = real(string_char_at(nString,n));
}
file_text_readln(nFile);
}
file_text_close(nFile);
}
EDIT- Awesome, got it! I changed:
map[n,i] = real(string_char_at(nString,n));
to:
map[n,i] = real(string_char_at(nString,n+1));
Thanks again!



Find content
Not Telling
