Page 1 of 1

parse settings file

Posted: Sun Oct 03, 2010 11:41 am
by Brujah
My game uses a settings file that looks like this:

Code: Select all

# Lost Labyrinth Settings File
# This in only a prototype!!!
# After saving in the game the actual settings file will be here:
# Users Homedirectory + '/.lostlaby'
language = english   # english, german, spanish
mydelay  =   200   # Messages    (5 Digits!)
mydelay2 =     0   # Scrolling   (5 Digits!)
mydelay3 =    30   # Mouserefesh (5 Digits!)
mydelay4 =     0   # Animationen (5 Digits!)
joystick = no   # yes, no
no_mouse = no   # yes, no
windowed = no    # yes, no
sound = yes   # yes, no
music = yes   # yes, no
klicking = yes   # yes, no
auto-toggle = no    # yes, no
button5 = no    # yes, no
jars = yes   # yes, no
I would like to improve that. Does anybody here already have a routine to handle (parse) setting files?
Means like ignoring whitespace before and after the values.
Another option would be to transform the settings to an xml file.
What would you guys recommend?

Re: parse settings file

Posted: Sun Oct 03, 2010 12:33 pm
by Trond
Take a look at the preference library.

Re: parse settings file

Posted: Sun Oct 03, 2010 1:05 pm
by eesau
Yes, go with the preferences library. It will make handling settings files a million times easier.

Re: parse settings file

Posted: Tue Oct 05, 2010 6:00 am
by IceSoft
Or use XML.