INI files

For questions about using Classic.

Post » Tue Jan 19, 2010 6:50 pm

Can an .ini hold more an 1 variable? Or do I need to have 2 ini files to have name and high score?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Tue Jan 19, 2010 6:53 pm

[Highscore]
username=points
username2=points
...

Dont work? :S
B
2
G
2
Posts: 30
Reputation: 710

Post » Tue Jan 19, 2010 6:54 pm

.ini files can hold as many variables as have been declared in the .ini file its-self.

[code:3t8la607][Groups Are Declared Like This]

Items_Like_This = value

[This Is Another Group]

Items_Like_This = differentvalue

More_Items = value[/code:3t8la607]

You should be able to work the rest out through the relatively self-descriptive Construct events.
B
3
G
3
Posts: 46
Reputation: 967

Post » Wed Jan 20, 2010 5:29 am

Plus w/ Get Token expression, Write String action, and various system features in construct, you can easily store multiple values in one INI item.

Will probably explain how sometime soon.
B
2
S
1
G
3
Posts: 118
Reputation: 1,336

Post » Wed Jan 20, 2010 5:41 am

I have the score working but can't seem to add the player name that you type in the field. Little help please

http://www.box.net/shared/e8xn5qsple
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Wed Jan 20, 2010 7:55 am

This has made the expression list harder to read. But I'll try fixing that later.

This stores two variables in one item, one is a string, the other is a value.

Say I have a string that looks like this
Ohmah.1

I can use the GetToken Text Manipulator to get either the string, or the value.

GetToken("Ohmah.1",1,".") - Will return "Ohmah"
GetToken("Ohmah.1",2,".") - Will return "1"

Both as strings of course, but if you wanted to you could return them as integers.
B
2
S
1
G
3
Posts: 118
Reputation: 1,336

Post » Wed Jan 20, 2010 3:53 pm

I ma just6 missing something with the ini I tired this but get an error:
INI.ItemValue("PlayerName", "PName", "High Score", "Score")


@ShadeKirby500: I can't get the simple .ini, so I have no clue what do you with your GetToken tip. Sorry. (Perls before swine and all.) :-)

Can anyone mod my posed code? I think it just needs 2 lines,
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Wed Jan 20, 2010 5:53 pm

http://dl.dropbox.com/u/1646976/ini.cap

Think that'll help.

Also:

ZOMGbananas INI tut - viewtopic.php?f=8&t=4328

Mine with CRC32 (just ingnore the CRC32 and look at the reading & writing) - viewtopic.php?f=8&t=4572
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Wed Jan 20, 2010 8:52 pm

Your the MAN Minor!

I was so close! I didn't know you needed an & to make that work. Not sure if that fact is covered anywhere either.

Thanks
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Thu Jan 21, 2010 2:12 am

OK this worked fine on my Layout 1 sheet, but does not on my lay out 2 sheet. Are there special rules?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests