Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Maxsu

Uploaded by

maxsu2017

Virus scan

Safe to use

About this mod

A papyrus functions extender plugin that allow you to get four type of data (Int, Float, Bool, String) from your custom INI files by papyrus scripts.

Requirements
Permissions and credits
Changelogs
Brief Overview:

This is a SKSE plugin which adds several new papyrus functions into the game that relate to get data from INI files. Those new functions allow you to get four type of data (Int, Float, Bool, String) from your custom INI files by papyrus scripts.

This plugin should be able to provide many convenient to modders who want to create some custom preset settings for their own mod.


For normal players:

You don't need to know the detail information about this mod, the only thing you need to know is that some of the mods you had installed are requiring this plugin to make their functions working.

Therefore, you just need to download and install this mod and it dependency 
Address Library for SKSE Plugins with mod manager.


For Modders:

C++ source code of the DLL plugin is here: 
 https://www.nexusmods.com/skyrimspecialedition/mods/41555?tab=files&file_id=166260


Follwing the steps below, you can easily use papyrus scripts to get data from your custom INI setting.


1. Install the mod:



2. Enable the Debug Logs Printing:

  • It's highly recommond you to enable the debug logs function, so you can test the functions in a clear and easy way.

  • To enable the debug log, Go to "Data\MaxsuPapyrusINIGetterFiles" folder, and open "MaxsuPapyrusINIGetterSSE.ini", set the "EnableDebugMesPrint" option to 1 to enable debug log.

  • Go to "C:\Users\Administrator\Documents\My Games\Skyrim Special Edition\SKSE" folder, open "MaxsuPapyrusINIGetterSSE.log" to check the debug message.



3. Create your Custom INI Files:

  • Create a custom INI file, write down your custom setting inside it using the standard format. (https://en.wikipedia.org/wiki/INI_file#Format)

  • Copy and paste this file inside "Data\MaxsuPapyrusINIGetterFiles" folder, then when you enter the game, my mod's plugin will get your INI files from this folder.



4. Using the Extended Papyrus Script Functions:

  • There are five new added papyrus functions to help you get INI setting value from your custom INI files, you can check them in "Data\source\scripts\MaxsuPapyrusINIGetter.psc" file.


bool function IsINIGetterInstalled()

;Check if the DLL Plugin Install Correctly



int function GetIntFromINI(string file_name, string section_name, string key_name, int i_default_value = 0) 

;Get a Int Value from a INI file that placed in the mod files folder.

;file_name : The name of the ini file, includes filename extension. 

;section_name : The section name of the Int value.  

;key_name : The key name of the Int value.  

;i_default_value : The default Int value return when fail to get value from INI. 



bool function GetBoolFromINI(string file_name, string section_name, string key_name) 

;Get a Bool Value from a INI file that placed in the mod files folder. Will return fasle when fail to get value from INI. 

;file_name : The name of the ini file, includes filename extension. 

;section_name : The section name of the Bool value.  

;key_name : The key name of the Bool value. 



string function GetStringFromINI(string file_name, string section_name, string key_name, string s_default_value) 

;Get a String Value from a INI file that placed in the mod files folder.

;file_name : The name of the ini file, includes filename extension. 

;section_name : The section name of the String value.  

;key_name : The key name of the String value. 
 
;s_default_value : The default String value return when fail to get value from INI. 



float function GetFloatFromINI(string file_name, string section_name, string key_name, float f_default_value = 0.0) 

;Get a Float Value from a INI file that placed in the mod files folder.

;file_name : The name of the ini file, includes filename extension. 

;section_name : The section name of the Float value.  

;key_name : The key name of the Float value.  

;i_default_value : The default Float value return when fail to get value from INI. 


int function GetCreatedTime(string file_name) Global Native

; Get the Created Time of this INI file
; Will Return -1 if fail to get the value


int function GetModifiedTime(string file_name) Global Native

; Get the Modified Time of this INI file
; Will Return -1 if fail to get the value


5. Example Case:

Below is a simple example case that you can take as reference:

(1) Example INI File:

TestINIFile01.ini

; Put that file inside "Data\MaxsuPapyrusINIGetterFiles" folder

[Main]

TestIntValue01 = 233

TestBoolValue01 = 1

TestStringValue01 = MaxSu

TestFloatValue01 = 1234


(2) Example Papyrus Script:

Scriptname MaxSu_TestQuestAliasScript extends ReferenceAlias  

import MaxsuPapyrusINIGetter

int property DefaultInt = -1 autoReadOnly

;------- INI Setting Value-----------------

int testIntValue01
bool testboolValue01 = false
string teststringValue01
float testfloatvalue01

;---------------------------------------------

;---------------Default Value--------------------

string property DefaultString = "N/A" autoReadOnly
float property DefaultFloat = 1.0 autoReadOnly

;------------------------------------------------


;-----------File Time----------------------------

int CreatedTime
int ModifiedTime

;-----------------------------------------------



Event OnInit()

if (!IsINIGetterInstalled())
return
endif

CreatedTime = GetCreatedTime("TestINIFile01.ini")
ModifiedTime = GetModifiedTime("TestINIFile01.ini")

ReadINISetting()

EndEvent



Event OnPlayerLoadGame()

if (!IsINIGetterInstalled())
return
endif

if (CreatedTime != GetCreatedTime("TestINIFile01.ini")) || (ModifiedTime != GetModifiedTime("TestINIFile01.ini"))

ReadINISetting()
CreatedTime = GetCreatedTime("TestINIFile01.ini")
ModifiedTime = GetModifiedTime("TestINIFile01.ini")

endif

endevent



Function ReadINISetting()

testIntValue01 = GetIntFromINI("TestINIFile01.ini", "Main", "TestIntValue01", DefaultInt)

testboolValue01 = GetBoolFromINI("TestINIFile01.ini", "Main", "TestBoolValue01")

string boolstring

if(testboolValue01)
boolstring = "true"
else
boolstring = "false"
endif

teststringValue01 = GetStringFromINI("TestINIFile01.ini", "Main", "TestStringValue01",DefaultString)

testfloatvalue01 = GetFloatFromINI("TestINIFile01.ini", "Main", "TestFloatValue01", DefaultFloat)

debug.messagebox("Int Value is " + testIntValue01 + " Bool Value is " + boolstring + " String Value is " + teststringValue01 + " Float Value is " + testfloatvalue01)

EndFunction