• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Import File

M

M4v3r1k

Guest
Hi Everyone

I'm having some trouble on importing a file in my code.
Hope someoune can point me in the right direction

I save test.txt in the working directory and now tryng to open it with this code:

GML:
var i, file;
file = file_text_open_read(working_directory + "test.txt");
for (i = 0; i < 10; i += 1)
   {
   scr[i] = file_text_read_real(file);
   file_text_readln(file);
   scr_name[i] = file_text_read_string(file);
   file_text_readln(file);
   }
file_text_close(file);
than I would like to double check the content in this way:

show_debug_message(scr[1])
show_debug_message(scr[2])
show_debug_message(scr[3])


but I get this error message:

File is not opened for reading.
at gml_Object_obj_import_button_Mouse_0 (line 7) - scr = file_text_read_real(file);

In the Source Control windows I can read:
ERROR!!! :: Failed to open file: Y:\Chess_Engine_2_3E78BA7C_VM\test.txt

looks like the system look for the file in wrong place (I don't have Y: drive)

Thanks to everyone that can help

M.
 
Last edited by a moderator:
Top