Difference between revisions of "Introduction to Pluggy INI Files"

Finishing article
imported>Speedo
(New page: The latest version of Pluggy supports the use of INI config files. This article gives a brief overview of INI files, and how to use them via Pluggy. ==What is an IN...)
 
imported>Speedo
(Finishing article)
Line 1: Line 1:
The latest version of [[:Category: Pluggy|Pluggy]] supports the use of INI config files.  This article gives a brief overview of INI files, and how to use them via Pluggy.
The latest version of [[:Category: Pluggy|Pluggy]] supports the use of INI config files.  This article gives a brief overview of INI files and their usage.


==What is an INI?==
==What is an INI?==
Line 7: Line 7:
====Sections====
====Sections====


A section is denoted by a name in square brackets ([]).  Sections are used primarily for the organization of data within the file, so that it is easier to find information when viewing an INI file in a text editor.  For example, if I wanted to create an INI that stored detailed information about the player's character, I might want to some of these sections to keep the file organized:
A section is denoted by a name in square brackets ([]).  Sections are used primarily for the organization of data within the file, so that it is easier to find information when viewing an INI file in a text editor.  For example, if I wanted to create an INI that stored detailed information about the player's character, I might want to use some of these sections to keep the file organized:
  [General]
  [General]
  [Attributes]
  [Attributes]
Line 22: Line 22:
*Strings
*Strings


Each key has a name, with an equals sign (=) seperating the key's name from the key's value.  We can now expand our INI file about the player with actual data:
Each key has a name, with an equals sign (=) separating the key's name from the key's value.  We can now expand our INI file about the player with actual data:
<pre>
<pre>
[General]
[General]
Line 35: Line 35:


[Spells]
[Spells]
Spell=000A97DF
ActiveSpell=000A97DF


[Equipped Items]
[Equipped Items]
Line 60: Line 60:
[Spells]
[Spells]
;StandardFireDamageTarget1Novice ("Fireball")
;StandardFireDamageTarget1Novice ("Fireball")
Spell=000A97DF
ActiveSpell=000A97DF


[Equipped Items]
[Equipped Items]
Line 67: Line 67:
</pre>
</pre>


==When should I use an INI?==
Generally, any time that you want to use a list of settings that can be modified outside of the game.  INI files could also be used as a means to store data in an organized manner, allowing players to share information (such as data about their character, in the above examples) or settings with friends.
====INI vs. RunBatchScript====
Many people are already using files to load settings via the OBSE function [[RunBatchScript]] - why then would you want to use INI files?  Well, they have several advantages.
*Data is more organized, so it's easier for players to understand what they're looking at when editing the file.
*The "KeyName=Value" syntax of INIs simple and more direct than the "set SomeVariable to Value" scripting commands needed by [[RunBatchScript]]
*The '''IniRead___''' functions require you to give them a default value which is used if a key is invalid or the player has accidentally damaged the INI file.
**Because of the default values, less code is needed to check the loaded data for errors; simply go ahead and use the default values.
*The '''IniWrite___''' functions can be used to update any values that may have changed via an ingame setup menu or etc.  There's simply no way to do this with [[RunBatchScript]].
==Relevant Functions==
See each function's page for more information about its syntax and usage.
====Loading Data====
*[[IniReadInt]]
*[[IniReadFloat]]
*[[IniReadRef]]
*[[IniReadString]]
====Saving to File====
*[[IniWriteInt]]
*[[IniWriteFloat]]
*[[IniWriteRef]]
*[[IniWriteString]]
====Other INI functions====
*[[IniKeyExists]]
*[[IniDelKey]]


[[Category: Pluggy]]
[[Category: Pluggy]]
Anonymous user