Text set text to INI.ItemString("Names", "Name3")[/code:2grvp9ic]
Using an event similar to that should cause the name Jack to appear in the text object.
To explain what the condition means; obviously we are taking the Text object, and setting the text to something. We have specified that we want to set the text to what we find in our loaded .ini file. Inside the brackets, we tell Construct exactly which part of the .ini we want to display. "Names" is the name of the group we want to look in. Telling Construct to look there will cause it to ignore any other groups in the file during this condition. Then, we tell Construct to look at the item Name3. Now that we have specified the group and the item, Construct can now take the string contained in Name3, and display it in the Text object.
Worth noteing in relation to where we said INI.ItemString in the above event. When loading data from an .ini file, you can grab it in two different ways, with .ItemString or .ItemValue. If you are only storing text, or things you want to appear as text, then use .ItemString. However, if you are using an .ini file to load a value for something you need to use in any math, like a weapons power or a sprite location, you want to use .ItemValue. If you use ItemString when you want to load a number you want to manipulate later on, Construct will consider it as a text string, and you will be unable to use it in math operations and the like. On the other side, if you load text using .ItemValue, Construct will be unable to use it in math, and will default it to a value of 0. So, when loading data from an .ini file, make sure you use the right expression for the purpose you want to use that data for.
This is only a simple example of the use of an .ini file. Once you begin to explore and understand how to manipulate them, their uses increase dramatically. You can use an .ini file to store locations of sprites placed in a level editor for saving, or read them for loading them, or for various attributes for items in your RPG. A small RPG item list might look like this:
[Item1]Name=Bronze Sword
Power=20
Weight=5
Cost=100
Description=A simple, uninteresting sword cast from bronze
[Item2]
Name=Holy Sword
Power=200
Weight=30
Cost=10000
Description=A sword of holy vengeance, once held by an angel[/code:2grvp9ic]
To make use of that data when loading, you would specify which one of the items you want to use (if you wanted to use the Holy Sword, you would specify Item2 as the group), and then you can load the data from the items Name, Power, Weight, Cost and Description. Use .ItemString for Name and Description (because the data inside is text, and we will only really use that data in a text object), and .ItemValue for Power, Weight and Cost (because we want the data to remain as values, so we can use them later in equations to determine how much damage the sword does, how much it costs to buy one, and so forth). How you would use that data is up to you to work out though, I'm only showing you how to get those values out of a .ini file.
I'm including a sample .cap so you can see the use of a .ini file in action. Again it's nothing special, but if you don't know how to use a .ini file, this should hopefully give you a rough idea of the things that you can do. Feel free to open up the .ini file to see how I've structured it. I've also commented the .cap, and I hope it's simple enough to understand my rambling in there.
[b]Note[/b]: When extracting the .rar, keep the .cap and the .ini in the same folder as each other, otherwise the example won't work.
[b]Using the .cap[/b]: The .cap produces 100 stars on the screen, and gives them all a name (set in two private variables). The names are randomly pulled from the .ini file. When you hover over one of the stars, the text object at the bottom of the screen will display the name of the star.
[b]Construct Version[/b]: The example was made in the latest (0.99.42) version of Construct, so will not open in earlier versions, so you may need to update to be able to use it.
I hope my little explanation of using an .ini file and the .cap I've provided were easy enough to follow, and help some people out. Feel free to use the .cap in any way you wish; mess around with it, adapt it for your own projects, whatever you like.
[url=https://files.getdropbox.com/u/1414019/starmap.rar]https://files.getdropbox.com/u/1414019/starmap.rar[/url]