SetINIInteger Cached
From GECK
(Redirected from SetINIIntC)
A function added by the ShowOff NVSE Plugin version 1.50.
Contents
Description
Sets the integer value of an INI key.
Only affects a cached version of the INI file! To save the changes to the actual file, SaveCachedIniFile must be called.
- If the file was not previously cached, then it becomes cached.
- Caching eats memory, but allows faster access to the data.
- Once the cache is no longer needed, ClearFileCacheShowOff should be called to free the memory.
If an error has occured, will return -1. Otherwise, returns 1 if the key existed previously and was updated, or 2 if it was inserted.
If the value is created and comment is not an empty string, will add the comment above the created key:value pair.
Syntax
(iResult:int) SetINIInteger_Cached sectionAndKey:string newValue:int iniPath:string{""} comment:string{""}
Or:
(iResult:int) SetINIIntC sectionAndKey:string newValue:int iniPath:string{""} comment:string{""}
Example
SetINIInteger_Cached "SomeSection:iSomeSetting" 2 "MyFolder\MyFile.ini"
Once this function is called it should automatically make an INI file (If not created already) named MyFile.ini in "Data\Config\MyFolder"
The INI file should now contain the following:
[SomeSection] iSomeSetting = 2
Notes
- INI files are read from and written to in the Data\config\ folder (as in MCM's INI functions). Format Example
- If no filename is specified, the name of the mod the function is called from is used. Subdirectories can be defined in the path, e.g. "subDir\nameOfFile"
- It is likely that if you include a subdirectory, you will go over the parser limit. If this occurs, the script will compile but will not work in-game. This can be solved by passing a string variable instead.
- Writing to an INI file that does not exist will create it along with any non-existent subdirectories in its path.
- sectionAndKey is a string containing both the section and key in the format: "Section:Key" ('\' and '/' may also be used as the delimiter.)