Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Meridiano

Uploaded by

MeridianoRus

Virus scan

Safe to use

Tags for this mod

About this mod

This SKSE64 plugin adds the ability to read and write ini files using Papyrus scripting.

Requirements
Permissions and credits
Changelogs
"Papyrus Ini Manipulator" is a SKSE64 plugin that adds some Papyrus functions to read and write ini files with correct structure - unique sections within a file, unique keys within a section and so on. Regular ini files in sum.

[section]
key = value


Brief overview - Papyrus

String Function GetVersion() > returns "1-7-2-0" string.

Bool Function IniDataExists(Int iLevel, ...) > level-dependent function.
  • iLevel is 0 > returns if file exists on given sPath.
  • iLevel is 1 > returns if section exists on given sPath and sSection.
  • iLevel is 2 > returns if key exists on given sPath and sSection and sKey.

Bool Function ClearIniData(Int iLevel, ...) > level-dependent function. Returns boolean true on success and boolean false on fail.
  • iLevel is 0 > clears file on given sPath making it empty with no sections and keys and values.
  • iLevel is 1 > clears section on given sPath and sSection making it empty with no keys and values.
  • iLevel is 2 > clears key on given sPath and sSection and sKey making it empty with no value.

Bool Function DestroyIniData(Int iLevel, ...) > level-dependent function. Returns boolean true on success and boolean false on fail.
  • iLevel is 0 > removes file on given sPath with all its content.
  • iLevel is 1 > removes section on given sPath and sSection with all its content.
  • iLevel is 2 > removes key on given sPath and sSection and sKey with all its content.

String[] Function GetIniData(Int iLevel, ...) > level-dependent function.
  • iLevel is 0 > returns array with all sections in file on given sPath.
  • iLevel is 1 > returns array with all keys in section on given sPath and sSection.
  • iLevel is 2 > returns array with all chars in value on given sPath and sSection and sKey.

Bool Function PullBoolFromIni(...) > returns the boolean value on given sPath and sSection and sKey. Returns bDefault value on fail.
Int Function PullIntFromIni(...) > returns the integer value on given sPath and sSection and sKey. Returns iDefault value on fail.
Float Function PullFloatFromIni(...) > returns the float value on given sPath and sSection and sKey. Returns fDefault value on fail.
String Function PullStringFromIni(...) > returns the string value on given sPath and sSection and sKey. Returns sDefault value on fail.

Push functions are force-dependent. This means that if bForce is false then the key must exist to be written. And if bForce is true then the data will be written even if the file/section/key doesn't exist. This applies to files and sections and keys as well, so you can create them. These functions return boolean true on success and boolean false on fail.

Bool Function PushBoolToIni(...) > writes boolean on given sPath and sSection and sKey.
Bool Function PushIntToIni(...) > writes integer on given sPath and sSection and sKey.
Bool Function PushFloatToIni(...) > writes float on given sPath and sSection and sKey.
Bool Function PushStringToIni(...) > writes string on given sPath and sSection and sKey.

Brief overview - Console

This plugin also introduces 2 console commands to push and pull values to and from ini files.
  • PullValueFromIni or PVFI >  returns string value on given path and section and key.
  • PushValueToIni or PVTI > writes string value on given path and section and key using force or not.

Minor Info

  • Comments are supported with the first ";" symbol in line or in section lines, but not in key/value lines.
  • All functions are case-independent because Papyrus is case-independent. Writing to files will use lower case.
  • Writing boolean value will write strings "false" or "true". If you want to write 0 and 1 then write integer {bMyBool as Int}.
  • Using force in push functions rushly may harm ini files with incorrect structure.
  • You can use both absolute and relative paths to your files. Relative pathing starts in the game root, so you should use "Data/SKSE/SKSE.ini" for example.

Plugin Config

This plugin has config file just as many other plugins.

bUsePrettyPrint > if true then writing to files will use spaces and empty lines like this

[section_a]
key_a = value_a

[section_b]
key_b = value_b


If bUsePrettyPrint is false then it will look like this

[section_a]
key_a=value_a
[section_b]
key_b=value_b


bRegisterPapyrusFunctions > if true then Papyrus functions will be registered.
bRegisterConsoleCommands > if true then console commands will be registered.

It's tricky to create new console commands actually, so many authors just replace existing commands changing their names and methods, and you can configure which console commands the plugin will hijack to replace using sConsoleCommandToStealA and sConsoleCommandToStealB values. All vanilla console commands are listed here.

Compatibility

This plugin uses tiny mINI C++ code that doesn't use private profile functions so it's fully independent from PrivateProfileRedirector and allows authors to edit ini files manually during the game running. All changes will be read as is.