Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Questions about text file limit

A topic by Ayyvo created Jul 20, 2020 Views: 97 Replies: 4
Viewing posts 1 to 2
(2 edits)

"Allows to open multiple INI files at once (as many as you want)." So is it possible for game maker to have more than 32 text files opened at once now?


The extension does not keep the files on disk opened like file_text functions do - rather, it grabs the content into a buffer, builds up a data structure representation of it, and converts back into a buffer and overwrites the file when saving.

You might be able to achieve a similar result for file_text functions by passing the string from a buffer into file_text_open_from_string, although I'm not sure where the limit is checked for.

Huh, that's really interesting. So, in theory, the limit is basically either what ever the limits of Game Maker are, or the actual ram limits of what ever computer it's running on?


Correct - for example, this works as intended and successfully prints values from 1024 different files:

// pre-generate 1024 INI files:
for (var i = 0; i < 1024; i++) {
    var f = file_text_open_write("f" + string(i) + ".ini");
    file_text_write_string(f, "[test]");
    file_text_write_string(f, "index=" + string(i));
// open INIs:
for (var i = 0; i < 1024; i++) {
    inis[i] = file_ini_open("f" + string(i) + ".ini");
// print values:
for (var i = 0; i < 1024; i++) {
    show_debug_message(file_ini_read_real(inis[i], "test", "index", -1));

niiiiiiiiiice, this is really rad! Thank you for making this really cool extension :D