Text Files

This section of the manual deals with the functions for text files.

Text files are a useful way to store large amounts of data externally from your game. Contrary to ini files, you can have up to 32 text files open at once, and you can read and write large chunks of data to them as well. However, it is up to you to decide how that data should be structured as there is no set "section" or "key" structure like with *.ini files.

Please note that for games with localizations it is very important that accented letters can be read from external files. This means that you should create the txt file in UTF8 format first and then add it into GameMaker: Studio as an included file so that it is exported on running the game and used instead of the default ANSI format txt file that is created by the GameMaker: Studio file functions when no file is previously supplied. In this way, you can read and write to it correctly with all accents and non-roman letters being maintained.

The following functions exist that deal with files:

  1. file_text_open_read
  2. file_text_open_write
  3. file_text_open_append
  4. file_text_open_from_string
  5. file_text_read_real
  6. file_text_read_string
  7. file_text_readln
  8. file_text_write_real
  9. file_text_write_string
  10. file_text_writeln
  11. file_text_eoln
  12. file_text_eof
  13. file_text_close


WARNING! This function may not work as you expect due to GameMaker: Studio being sandboxed! Please see the section on File System Limits for more information.


Back: File Handling
© Copyright YoYo Games Ltd. 2018 All Rights Reserved