Mirage Source
Working with INI - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Working with INI (/showthread.php?tid=1003)



Working with INI - Xlithan - 11-06-2007

I've been working on something lately, and I need to do something that I haven't done with an ini file before. I haven't yet messed around with this bit as I'm in the process of programming the other parts.
I wouldn't say it's a complex idea, which is why I've posted this in the beginner section. Thinking about it in my mind though hasn't seem to spark any good methods of achieving it, so I wanted to get some possible solutions from other people before I attempted to start working on this part of the system.

The ini file is made up of 4 different headers, each containing 10-100 values, which will contain players names. I've put 5 on here as an example:

Code:
[HEADER1]
Name1=
Name2=
Name3=
Name4=
Name5=
[HEADER2]
Name1=
Name2=
Name3=
Name4=
Name5=
[HEADER3]
Name1=
Name2=
Name3=
Name4=
Name5=
[HEADER4]
Name1=
Name2=
Name3=
Name4=
Name5=

Now, the first bit of this part of the system involves adding names and removing names. Finding a blank space and adding the name is fairly easy. Now I need to add some code that removes a specific name from one of the headers.

The next bit of this involves working with both of those methods, removing a specific name and adding it into a specific header.

I could probably use this system for my WizList security feature too, making it more easy to add and remove GMs from the WizList.

Thanks.


Re: Working with INI - Dragoons Master - 11-06-2007

That's white easy, use the INI functions that you already have at your game and loop thru all the posible names searching for a name. It's no problem at all, the ini functions already make all the hard work for you. Just loop it ^^


Re: Working with INI - Xlithan - 11-06-2007

problem solved I think. Some more testing needed but I think I've got it.