• 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!

GML File Handling

A

aGreenCrystal

Guest
Hey, this is my first time using files handling, so I don't understand much.
I used this Code:
1.png
to read out a file.
Sadly, it gives me this error message:
2.png
Can anyone tell me what I have to change for it to work?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Where is said file located within the project's structure?

Make sure to verify if a file exists (and can be seen by the game) using file_exists before trying to access it.

Try using "rooms.txt" as the file path if the file is in the root folder of your included files. Path finding on the target platform's file system is automatically handled, you do not have to specify an absolute file path.
 
A

aGreenCrystal

Guest
Where is said file located within the project's structure?

Make sure to verify if a file exists (and can be seen by the game) using file_exists before trying to access it.

Try using "rooms.txt" as the file path if the file is in the root folder of your included files. Path finding on the target platform's file system is automatically handled, you do not have to specify an absolute file path.
The file is located in the same folder as the file you click when loading the program into gamemaker. I changed the path to "rooms.txt", but it gave me the same error :/
(also if I use show_debug_message together with file_exists, it gives no output)
 

TsukaYuriko

☄️
Forum Staff
Moderator
So the file is not an included file and thus not anywhere within your project structure. You will not be able to access the file this way.


You seem to be misunderstanding where your project is running from. It's not the directory where the editable project file and its resources are stored. Detach your mind from the idea that you will be able to load anything from that folder, as it is not the case.

If you want to access the file at run time, add it as an included file - by this, I mean the Included File resource type within your project, not adding it to your source folder.

For further reference: https://docs2.yoyogames.com/source/_build/2_interface/1_editors/included_files.html
 
Top