GMS 2 Loading Multiple Images and Variables from INI file ?

I wish to load multiple images and a few variables from an ini file within several folders in the working directory.

Basically, anything you put in a specific folder in the working directory gets loaded into the game on start, while also being assigned several variables.

With variable = sprite_add(), variable = ini_read_string(), etc. it workes just fine however I can't seem to figure out how to get it to load from multiple ini files and to store this information in an array. Any attempts so far have resulted in my program crashing.

Does anyone know a good way to store external images in variables that can then be used by the program?
 
Are you trying to open more than one ini file at the same time?

You can only open one at a time, you can only open a second one once you have closed the first one with ini_close()

For loading images, you can either store the name of the image file in the ini file as a string, and use that to load it.

Or, if you keep all you images in a certain folder and/or folders, you can loop through the folder using file_find_first() and file_find_next() to load all files of a certain type.
 
It might have been that I tried to open two ini files in the same script (although I did use ini_close). I solved it by using an object that holds all the variables from the ini files and the variables for the external sprites instead of in an array.

What this was for was loading custom sprite sets with their own variables into a level editor. It works well enough now so it's not a huge priority to make the code more efficient at the moment.
 
Top