Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Thiago

Uploaded by

SkyrimThiago

Virus scan

Safe to use

Tags for this mod

About this mod

This is a simple ini loader i made to configure my other mods

Requirements
Permissions and credits
i know there are already ini solutions but i wanted to make my own.

It uses a singleton design pattern, so it will only read and parse the file for the first time you call a ReadXXX data, the rest it will get it from memory. After you are done fetching data from the INI, you can call the function Dispose, which i strongly suggest you to do as it frees memory and the next time you want to read from the INI it will get a newer version of the file if it was updated.

All exceptions that could happen are handled, this adds a little overhead but is totally worth it.

All keys and sections are case insensitive

Given we have a simple ini file

[MagicLongSword]
AttackDamage = 25

You can call functions to read from the ini, all with the same parameters but for their givem return type


File: The path of the file, it starts from the data folder. example (The .ini at the end is optional):  Mythic Items
Group: The section of the ini which for this mod is mandatory, example: [MagicLongSword]
Config: The key of the ini, example: AttackDamage = 25
Default: (optional parameter) if the key was not found or is empty, this value will be returned instead, example: 10.0

Here is how it would look like:

Float Magnitude = INILoader.ReadFloat("Mythic Items","MagicLongSword"," AttackDamage", 10.0)

All the avaliable functions:

int function ReadInt(string file, string group, string config, int default = 1) global native

string function ReadString(string file, string group, string config, string default = "") global native

float function ReadFloat(string file, string group, string config, float default = 1.0) global native

bool function ReadBoolean(string file, string group, string config, bool default = false) global native

There is also a dispose function that must be called when you are done reading from the ini

INILoader.Dispose("Mythic Items")

function Dispose(string file) global native