The Daily Click ::. Forums ::. Klik Coding Help ::. 8 INI files... anyone object?
 

Post Reply  Post Oekaki 
 

Posted By Message

Dave S.



Registered
  26/09/2003
Points
  924
8th November, 2004 at 13:42:06 -

I'm almost ready to submit a game but it has eight INI files instead of one. I have read lots of articles on INI and groups etc but can't get it to work for me... always seem to get syntax errors...

I have tried all sorts of variations, for example, 'set counter to' GroupItemValue(game,stats,blue), GroupItemValue(INI,stats,blue), GroupItemValue("Ini",stats,blue)... none of these work!

My game.ini file in notepad looks something like this,

[stats]
blue=111
gold=222
green=333

[misc]
level=1

Anyhow, I assume you add the INI file(s) to the already zipped stand-alone game.

Dave S.

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
8th November, 2004 at 14:00:26 -

GroupItemValue( "Ini", "stats", "blue" )
Where Ini is your Ini object name (within the game)

 
My signature is never too big!!!

Dave S.



Registered
  26/09/2003
Points
  924
8th November, 2004 at 15:06:57 -

Thanks Joe... I'll try it out. Not sure if I will implement it this time as it means changing lots of code.

Over and out Dave S.

 
n/a

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
8th November, 2004 at 15:13:45 -

Do you wan't to group you'r ini info. or just use 1 ini file. Anyway, I don't know how to group them, becouse I dont find it usefull. But this is the code for saving inis in one inifile (for MMF):

Loading:
-first create a level that loads your game
-create the ini file
-do this code to save values:
Start of level = Set counter to: ItemValue( "save", "counter" )
do this for every counters you got

Saving:
create a new level that saves
create the ini file with the same name and all
do this code: under the ini section
Start of frame: Set value value to "counter" to item "Dave" <- ini info.


 
http://www.robocaptain.com

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
8th November, 2004 at 18:36:26 -

This may be too late, but I don't really care how many ini files you have (although 8 does seem a few too many, but what the hell) as long as you keep them in the same directory as the game. This avoids putting files into players' windows directory without them knowing. Where ever you specify the path of the INI file within the game itself, make sure you say:

AppDrive$ + AppDir$ + "filename.ini"

as opposed to just "filename.ini". Also, unless you want to put some preset values into the ini files, you don't need to include them in the zip - they'll be created automatically.

 
n/a

Crystal Clear (H.E.S)

Possibly Insane

Registered
  06/10/2002
Points
  2548
9th November, 2004 at 01:01:19 -

INI files have a max size of 64kb, so if their quite big Ini files best of having them seperate, if they only contain small amounts of information best off grouping them like mentioned above. I dont care if i have 1 or 8 Ini files from a game, but if you do have 8 put them all in a sub-directory like:
Appdrive$+Appdir$+"\Data\"

 
HES homepage:
http://www.distinctiv-efair.com/heretic/studios
Crystal Clear Productions: http://www.distinctiv-efair.com/heretic/crystalclear

Dave S.



Registered
  26/09/2003
Points
  924
9th November, 2004 at 16:53:18 -

Well after alot of messing about I've now finished up with just one INI file instead of eight!

Arf, if I set the current file to AppDrive$ + AppDir$ + "filename.ini" and then run the application all the INI information is lost. I need the INI file as it has initial values.

Dave S.

 
n/a

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
11th November, 2004 at 17:16:36 -

Just to make sure -- you need to change the "filename.ini" bit to whatever is the name of your actual ini file. As long as the file is in the same directory as the game itself then this should work.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
12th November, 2004 at 08:31:31 -

You didn't lose it, only thing you have to do (using TGF) is copy the INI file from .\WINDOWS\ to your appdir.

 
Old member (~2004-2007).

Dave S.



Registered
  26/09/2003
Points
  924
13th November, 2004 at 15:18:34 -

At start of frame "appdrive$ + appdir$ + myfile.ini" or "myfile.ini" still doesn't seem to work. It looks in the Windows directory even though my .exe and .ini file are in the same temp directory. Why is this? It seems the .ini file has to be in the Windows directory for the game to save and load.

Dave S.

 
n/a

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
17th November, 2004 at 08:34:22 -

I have a source for my application that uses some pretty extensive INI features...at least to the point of learning appdrive and blah blah....if you want it...mail me...

 
thinking is like pong, it's easy, but you miss sometimes.

Jimmy Brzezicki



Registered
  16/09/2003
Points
  1057
17th November, 2004 at 09:14:59 -

You think that's bad... I kind of guessed how to use them (at first) and as a result Grizzlies 3 used around 40, at which point TGF gave up on saving information (hence the lack of challenges). Several times I sat down and tried to organise that all into one file but it just crashed the editor.

Image Edited by the Author.

 
Why the hell am I on the computer at 1 in the morning? No, don't answer.

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
17th November, 2004 at 12:05:07 -

Dave S, you keep getting your strings wrong. Anything in "quotes" is a constant string which can never change. So "appdrive$ + appdir$ + myfile.ini" is the exact string you are telling Windows to load, obviously that's not a valid filename, because it needs a drive, slashes between directories and so on.

Text outside quotes can change, eg:
appdrive$ + appdir$ + "myfile.ini"
Here, appdrive$ can change because it's not in quotes (it's variable). In this case, it will always change to be the drive letter of the application. "myfile.ini" will never change because its in quotes, which is OK because your file is always called myfile.ini.

The above appdrive$ + appdir$ + "myfile.ini" will load the ini file myfile.ini from the same directory as your application. If you just type "myfile.ini" it goes in the Windows directory (which is extremely annoying for end users). So you need to copy the ini file from the Windows directory to the same directory as your application to keep the previous data.

 
- Tigerworks

Dave S.



Registered
  26/09/2003
Points
  924
18th November, 2004 at 11:11:16 -

Tigerworks, thanks for the advice. I think Arf said exactly the same thing but I got confused somewhere along the line.

I've already submitted the game but if the line of code works I may submit an updated zip file to Arf (who's hosting it) but I'd have to ask him first.

Dave S.



 
n/a
   

Post Reply



 



Advertisement

Worth A Click