What are ini files?
Blitz3D Forums/Blitz3D Beginners Area/What are ini files?
| ||
This may sound like a dumb question but i have seen them but never actually tried to work out what they do. Some one mentioned it so i decided to find out. So if anyone can help please post. Thanks MattVonFat |
| ||
uh .. usually ppl use .ini files to store certain global variables, like paths. If you have eurora as email-application, check out eudora.ini .. it also holds lotsof info (your email settings!), info that you typically want to store in a file that's readable by us human beings.. I once made a little Boulderdash clone in B+, I stored the mapwidth, mapheight and framerate in an ini-file that I automaticaly load at game startup. This way I can vary the size of the map 'outside' the source, meaning that I don't need to recompile the project. |
| ||
kwl but couldn't you just use a *.txt file for that. |
| ||
which is the same :) ".ini" makes more sense to me as it describes 'initial values'. |
| ||
ah ok, thanks! |
| ||
Clicky I created an ini file updater thingy here. It might be usful to you if you start using ini files |
| ||
. |
| ||
rob can I use that peiece of code in a game I am making possibly comercial! |
| ||
thanks for the help rob, that script has made it easier to understand! |
| ||
I have e-mailed u! |
| ||
Using Ini files as a Limited *DataBase*... Ini files are basically INDEXED files not text files.. Main Key= Section Name Sub Key = Section Detail (You can create this key) e.g., Assume you want to store the *Last Played* data for each person who has used your app.. want to keep..Date played,mins played, highest score... [MyAppPlayed] ---- Section Name/Key Tommy Roe=20040507,45 Mins,Score 125 (Key is Tommy Roe) Mickey Mouse=20040508,180 Mins,Score 1120 etc,, API: GetPrivateProfileString("myAppPlayed", "Tommy Roe", "Not Found", (Default return) RtnString, 1024, "C:\...\MyIniFileName.ini") returns 20040507,45 Mins,Score 125 You would have to parse out the CSV fields (assuming you have more than one) The API can also return All sub keys to allow you to loop through them... i.e., GetPrivateProfileString("myAppPlayed", Null, "Not Found", (Default return) RtnString, 1024, "C:\...\MyIniFileName.ini") rtn String contains Tommy Roe/Null/Mickey Mouse/Null/ etc.. And of Course INI files can contain Many Different Sections. The Only limitation that I can recall is that they (Ini) must be <= 64KB in size... Store data using the API.. WritePrivateProfileString ... They are quite easy to use and can be quite powerful if you have the need for simple indexed app.. |
| ||
thx for the reply |