Why is my file_text_read_string not working in GML?

Viewed 12

I have the below GML code where I am attempting to read strings from "mygame.txt". When I run the code, the array is just filled with "". I found the buffer section of code and I can see that the var s actually contains the contents of my game. Any idea why the array, arr[] does not properly read the string?

lines= 0
var file = file_text_open_read("mygame.txt"); // need to store in "data files" folder

if (file!= -1){
    while (!file_text_eof(file)) {
        file_text_readln(file);
        lines++;
    }
    var file_buffer = buffer_load("mygame.txt");
    var s = buffer_read(file_buffer, buffer_string);
    buffer_delete(file_buffer);
    for (var i = 0; i < lines; ++i;){
        arr[i] = file_text_read_string(file);
        file_text_readln(file);
    }
    file_text_close(file);

    for (var i = 0; i < 1; ++i;){

    }}
0 Answers
Related