Another INI article? Yes, relax, get back in your chair, put your can of Diet Coke down, and turn that death metal CD up a bit. This is purely for new people who are confused by the concept of the damn things (and they can be a pain in the arse, believe me(the INIs, not the people)). So I will endeavour to be as simple as possible to minimise any confusion in my delicately minded audience. I know it’s been done before, but I’m doing it again, dammit. NB: I’ve based this on the features available in TGF rather than MMF so everyone will understand it.

What is INI?

INIs are a popular method for saving or loading information to or from a program, or, in our case, a game. You can open INI files in Notepad to see what’s there.

How do I put it in my game?

To insert an INI, click Create New and then click INI File. Type in a name, usually the name of your game, but it can be whatever you want. It’ll insert onto your level as an icon, but don’t be confused by this: the file itself is not actually in your game. Instead, all you have done is given your game the ability to access an INI file. Perplexed? Never mind. It’ll pass.

The different bits and bobs

An INI in TGF or MMF comprises of the following “bits” (technical term):

- The FILE = the actual physical file you are writing too.
- A GROUP = A group of ITEMS in your file
- An ITEM = a STRING or VALUE stored in your file, denoted by a name
- A STRING = a piece of text in the file
- A VALUE = a number in the file

OK, so you’re probably still confused. This is what an INI will look like when it’s set out:

[Group A]
Item A=this is a string
Item B=123
Item C=that was a value

[Group B]
Item A=this item is different from the last because it’s in a different group
Item B=I agree with item A


Hopefully, you can see what a Group is and what an Item is. Once you’ve learnt the jargon, the actual theory is dead simple. On we go…

Saving to an INI

Basically, when you save to an INI, you do three things:

- Set the group
- Set the item
- Set the contents of the item (e.g. a string or a value). This is referred to simply as “Set String” or “Set Value” in TGF.

These three things are done under the “INI” column in the event editor. You can have more than one action in a square on the grid, so you should wind up with something along the lines of:

+ User clicks Button “Save”
- Set current Group to “Player Info”
- Set current Item to “Name”
- Set string to “string from edit box”


This would produce the following in the INI itself:

[Player Info]
name=Pete


Of course, this is not to say that you can only save one item at a time. You can easily have:

+ User clicks Button “Save”
- Set current Group to “Player Info”
- Set current Item to “Name”
- Set string to “string from edit box”
- Set current Item to “DOB”
- Set string to “string from other edit box”


Or you could even change the group that’s being written to half way through. And that’s that. Saving to an INI file. Easy, yeah?

Side note: the “Set File” command is used to change the file you’re reading to/from. It doesn’t have to be the same file as the one you typed in when you set up the INI object in the level editor. You don’t need to use “Set File” if you only have one INI to save to.

Loading from an INI file

OK, so you’ve saved some stuff to your INI. But that’s pretty worthless without the ability to load it. The loading process is essentially the same, only with a couple of extras added, just to befuddle you further.

You still have to tell the game what bit of the INI to read from when you load, so that means setting the Group and Item you’re reading from like you do when you save. Make sure you spell the names correctly.

After you’ve set the groups, all that remains is to… well, load. Unfortunately, when using an INI file, you can’t have a condition like:

+ Value of INI file = 34
- Next Level


Instead, you need to set a counter or value TO the value off the INI. This is done in the expression editor: you use “Set counter to…” then “retrieve data from an object”, select the INI file object and then select either “Get Value” or “Get String” as applicable. The string/value will then be read from the Current Item of the Current Group, which you should have set beforehand. Remember not to set them again until you have finished reading the current value/string. Like before, you can have multiple actions in a single grid square, so you may well end up with something like:

+ User clicks Button “Load”
- Set current Group to “Player Info”
- Set current Item to “Name”
- Set Text1 to “string off “INI””
- Set current Item to “DOB”
- Text2 to “string off “INI”
- Set current group to “Age”
- Set current item to “Underage?”
- Set Counter1 to value off “INI”

+ Counter1 = 1
- Set Text3 to “You are underaged”


Remember; you can change the order the events execute by double clicking the checkmark on the grid and dragging them around.

You may want to use a counter as well to control the loading events, so that you have something like:

+ Counter = 1
- Set current Group to “Player Info”
- Set current Item to “Name”
- Set Text1 to “string off “INI””

+ Counter = 2
- Set current Item to “DOB”
- Text2 to “string off “INI”


etc, just to make it more ordered and easier to understand.

Well, that’s it: saving and loading with INIs. If you’re still confused to hell and back by the things, then comment below or dc-mail me. Or comment below if you have anything to add (or correct) that I’ve missed out.