Skyrim Special Edition

V1.00 ----------------------------------------------------------------------------------------

- (int)GetSUPSKSEVersion()
Returns current SUP SKSE plugin version.

-DebugPrintSUP(string sText, iRequest)
iRequest(optional parameter)
0 - Print text to console
1 - Print text to file
2 - Print text to both console and file

Example:

DebugPrintSUP("Element value>>>" +   myArray[0]) ; prints element to console
DebugPrintSUP("Element value>>>" +   myArray[0],1) ; prints element to file
DebugPrintSUP("Element value>>>" +   myArray[0],2) ; prints element to console and file


File is "aaSUPSKSEDebugPrint.txt" and it's located in root game folder. It's contents are deleted on each game start.


-(float) GetSystemTrait(int iTrait)
Returns current value of chosen system trait.
Traits:
0 - Major Windows version;
1 - Minor Windows version;
2 - Max system physical memory;
3 - Available system physical memory;
4 - Current memory load(%);
5 - How much time passed since PC started(ms);
6 - OS build number;
7- Screen resolution(width)
8- Screen resolution(height)



- CaptureScreenshot(string FileName, float iFormat)
Outputs contents of screen into an image file to Skyrim root folder.
Example -
CaptureScreenshot("aaMyScreen, 0)


Will output "aaMyScreen.jpg" to Skyrim root folder.

iFormats:
0 - .JPG
1 - .BMP;
2 - .GIF;
3 - .TIFF;
4 - .PNG;
5 - .DDS(see notes);

Notes:
  • It's impossible to delete screenshot taken using this function via scripts. If you want to manage screenshots later you need to use CaptureScreenshotAlt.
  • .DDS format is not real DDS texture but it can be read by game XML files so you can use it in UI mods just after extracting.
  • Quality parameter only works for .JPG(#0) and .DDS(#6) formats.


- CaptureScreenshotAlt(string ModFolder, string FileName, float XPosStart, float XPosEnd, float YPosStart, float YPosEnd, float iFormat,float iImageQuality)


Outputs contents of screen into an image file to to specified folder.

iFormats:
0 - .JPG;
1 - .BMP;
2 - .GIF;
3 - .TIFF;
4 - .PNG;
5 - .DDS(see notes);
6 - .DDS - smaller size(see notes);


Example -
CaptureScreenshotAlt("MyMod", "MyImage", 0, 1980, 0, 1080, 0,  50)


Will output screen contents from Screen position X of 0 to 1980 and Screen
position Y from 0 to 1080 to "MyImage.jpg" which will be located
under this path "Data\textures\SUPScreenshots\MyMod\MyImage.jpg"


Notes:

  • All folders and files are outputted to "Data\textures\SUPScreenshots\" folder. If you're using MO2 - they
    will be written into MO2 "Overwrite\textures\SUPScreenshots\" folder.
  • .DDS format is not real DDS texture but it can be read by game XML files so you can use it in UI mods just after extracting.
  • .DDS format #6 is recommended to use for UI elements purposes.
  • If there is a file in folder with the same name - it will be overwritten.
  • Quality parameter only works for .JPG(#0) and .DDS(#6) formats.


-(int) DeleteScreenshot(string ModFolder, string Filename)
Deletes screenshot previously taken using  CaptureScreenshotAlt function.
Returns 1 if file is found and deletion is succesfull.
Retuns -1 if file is not found.

Example
DeleteScreenshot ("MyMod", "MyImage.jpg")


Will remove "MyImage.jpg" under this path "Data\textures\SUPScreenshots\MyMod\MyImage.jpg" folder.

Notes:
  • This function will only delete screenshots in "Data\\textures\\SUPScreenshots" and nowhere else.
  • Opposed to function, you should specify image extension.
  • This function will return "-1" if file doesn't exist, and "-2" if folder doesn't correspong to game path.
  • This functions is absolutely safe to use, additional checks are made to make sure that no file outside
    "SUPScreenshots" folder can be deleted(unintentially or not).



-(bool) IsProcessRunning(string ProcessName)
Returns if specified process(programm) is running
IsProcessRunning "steam.exe" - will return if steam is running.


-(string) ClipboardToString()
Returns current clipboard value(if text) as a string

-(bool) StringToClipboard(string string_to_clipboard)
Passes specified string to clipboard. Returns true or false depending on the result.


-(string)GetSkyrimRootFolder()
Returns path to Skyrim root folder.



-(float)FileGetSize(string FilePath)
Returns size of specified file (in bytes). Returns -1 if file doesn't exist.
Internally checks if file exists so there's no need to precheck with
FileExists function. Doesn't work on folders.
This function doesn't look in BA2 archives.


-(bool) Function IsDLLLoaded(string FileName)
Returns if DLL by following name is loaded.
IsDLLLoaded "usvfs_x86" - will return if game started via MO2.




-(string)  StringReplace(string sString, string s_What_to_Replace, string s_What_Replace_With, int iRequest)

Replaces text in string.

Requests:
0 - for ALL occurrences;
1 - for First occurrence;
2 - for Last occurrence;

Example
        sRes =  "Marta,John,Marta"
Debug.Notification("Replacing ALL Marta To Jane in <Marta,John,Marta> >>>" +  
StringReplace( sRes,"Marta","Jane", 0))
        Debug.Notification("Replacing First Marta To Jane in
<Marta,John,Marta> >>>" +   StringReplace(
sRes,"Marta","Jane", 1))
        Debug.Notification("Replacing Last Marta To Jane in <Marta,John,Marta> >>>" +  
StringReplace( sRes,"Marta","Jane", 2))


-(string) StringErase(string sString, int iStartPos, int iCount)
Erases contents of string by specified position and character count
Example:
         sRes =  "LEAVE MY HOME"
        Debug.Notification("ERASING MY from LEAVE MY HOME > >>>" + StringErase(sRes ,6,3))



-(string) StringInsert(string StringA,string s_To_insert, int iPosition)
Inserts text to string by following position

        sRes =  "LEAVE MY HOME"
        sRes = StringInsert(sRes,"man",13);
        Debug.Notification("Adding Man to LEAVE MY HOME at 13>>>>" + sRes)
        sRes = StringInsert(sRes,"Please ",0)
        Debug.Notification("Adding Please to " + sRes +" at 0>>>>" + sRes)



-(string array)FileGetFileTime(string s_FilePath, int iRequest)
Returns  array with file time
Request:
0 - Creation time;
1 - Last access time;
2 - Last Write time;

Example:
        sRes_Ar = FileGetFileTime("CreationKitPrefs.ini", 0)
        Debug.Notification("Elements In File Time Array>>>" + sRes_Ar.Length  )
           currentElement = 0
           while (currentElement < sRes_Ar.Length)
            Debug.Notification("Element>>>" +   sRes_Ar[currentElement] )
                 currentElement += 1
           endWhile



-(string)GetSHA1FromFile(string s_FilePath)
Will return SHA1 hash value from file.  May do a performance hit for big files so use only when necessary.
    Debug.Notification("SHA1 from file >>" + GetSHA1FromFile("skse_loader.exe"))

-(string)GetSHA1FromString(string s_MyString)
Will return SHA1 hash value from string.

Debug.Notification("SHA1 from string >>" + GetSHA1FromString("MyTestString"))




-(float) GetHeadingAngleAlt(ObjectReference ObjectRef, float CallerX, float CallerY, float CallerAngleZ)
Returns the angle between the Point and the specified object in a range from
-180 to 180 degrees.This function is equivalent to GetHeadingAngle, only it takes coordinates of calling reference as parameters;


-(float) GetHeadingAngleBetweenPoints(float CallX, float CallY, float CallAngleZ, float TargetX, float TargetY)
This function is equivalent to GetHeadingAngle, only it takes coordinates instead of calling references.

-(float) GetDistanceBetweenPoints(float x1, float x2, float y1, float y2, float z1, float z2)
Returns the distance between two points.

-(string)FileDialogueBoxOpenFile(string sExtension)
Opens native Windows "Choose file" dialog box and returns a filepath to a file which user has chosen.
Example:
let MyString = FileDialogueBoxOpenFile("txt") ; will open dialogue box where user can choose only .txt files
let MyString = FileDialogueBoxOpenFile("txt,ini") ; will open dialogue box where user can choose only .txt and. ini files
let MyString = FileDialogueBoxOpenFile("") ; will open dialogue box where user can choose only any file

-This is an experemental function. It is only safe to call from menumode(when cursor is displayed), otherwise game can be softlocked because dialogue window is not visible.
-Game execution is halted during dialogue box.
-When user chooses the file nothing happens with the file itself. Only file path is returned as a string.

-(string)FileDialogueBoxOpenFolder()
The same function as above, only allows user to specify only folders.


-(bool)StringRegexMatch(string sStringIN, string sRegExpression, int iToLower = 0)
Determines if the regular expression matches string
iToLower paramater is added because string behaviour is papurys is somewhat unpredictable. If this parameter is true, string and regex are converted to lower case(internally i.e. in plugin, meaning original string  reference is not affected) before checking regex.

Example:
         DebugPrintSUP("Rexex Match result is " + 
StringRegexMatch("subject","(sub)(.*)") ) ; Will return false because
Papyrus converts "subject" into "Subject".
         DebugPrintSUP("Rexex Match TO LOWER result is " + 
StringRegexMatch("subject","(sub)(.*)",1) ) ; Will return true because
"iToLower" parameter is 1, this plugin converts
"Subject>>>subject" before checking regex.


-(string array)StringRegexSearch(string sStringIN, string sRegExpression, int iToLower = 0)
Returns string array of all substring matching regular expression.
Example:
        sRes_Ar = StringRegexSearch("this subject has a submarine as a subsequence","\\b(sub)([^ ]*)")

        DebugPrintSUP("Matches>>>" + sRes_Ar.Length  )
           currentElement = 0
           while (currentElement < sRes_Ar.Length)
            DebugPrintSUP("Match>>>" +   sRes_Ar[currentElement] )
                 currentElement += 1
          endWhile

-(string) StringRegexReplace(string sStringIN, string sRegExpression,string s_ToReplace, int iToLower = 0)
Replaces all substrings matching regular expression with specified string.
Example:
StringRegexReplace("there is a subsequence in the string","\\b(sub)([^ ]*)","sub-$2")



Mod Local Data:
Mod local data can hold your variable(float, int, Object reference, String) during gamesession. It is not tied to savegame which means if user  loads another savegame data persists. It is not saved to a savegame, it  doesn't need to be cleaned up. It only persists until the game is quit. The main purpose is to keep track  of changes made with SKSE functions  which persist through gamesession. Or i.e. make sure a script runs only once per game session.

Data is defined as key-value pairs, like a string map where the key is a string and the value may be a float, int,
Object Reference and string.
When you Set\Get Mod Local Data you need to specify "ModName"(Container). Mod name is a container name in
which your values are located. Each plugin can have as many "ModNames" as possible. They are shared between all plugins so yours has to be unique.

For instance:
ModLocalDataSetInt("ModName1", "NumTexturesChanged", 3) - Will set value of 3 to key ""NumTexturesChanged"" to "ModName1".
To retrieve the value you need to call:
float NumText = ModLocalDataGetInt("ModName1", "NumTexturesChanged")
Keys in container are unique which means that if you:
ModLocalDataSetInt("ModName1", "NumTexturesChanged", 5) - key "NumTexturesChanged" will have a new value.


- ModLocalDataSetFloat(string ModName, string Key, float Val)
Example:
ModLocalDataSetFloat ("MyMod", "MyKey", 3.2222223)

- ModLocalDataSetInt(string ModName, string Key, Int Val)
Example:
ModLocalDataSetInt ("MyMod", "MyKeyInt", 32)


-ModLocalDataSetRef(string ModName, string Key, ObjectReference Val)
Example:
         ModLocalDataSetRef ("MyMod2", "Pastor", PastorClements)


-ModLocalDataSetString(string ModName, string Key, string Val)
Example:
ModLocalDataSetString ("MyMod3", "MyPhrase", "yippee ki yay")


-(float)ModLocalDataGetFloat(string ModName, string Key)
ModLocalDataGetFloat ("MyMod", "MyKey")


-(int)ModLocalDataGetInt(string ModName, string Key)
Example:
ModLocalDataGetInt ("MyMod", "MyKeyInt")


-(ObjectReference) ModLocalDataGetRef(string ModName, string Key)
Example:
ModLocalDataGetRef ("MyMod2", "Pastor")


-(string)ModLocalDataGetString(string ModName, string Key)
ModLocalDataGetString ("MyMod3", "MyPhrase")


-(bool)ModLocalDataExists(string ModName, string Key)
Will return true or false whether Mod Data for this container and this key exists.
Example:
ModLocalDataExists ("MyMod3", "MyPhrase")

-(int)ModLocalDataGetType(string ModName, string Key)
Will return type of Value, if mod local data doesn't exitst - will return -1;
Types are:
1 - Float
2 - Int
3 - Object Reference
4 - String

-(bool) ModLocalDataRemoveKey(string ModName, string Key)
Will remove specified key from Mod Local Data.
ModLocalDataRemoveKey("MyBestMod", "MyKey4")


-(bool) ModLocalDataRemoveAllKeys(string ModName)
Will remove all keys from specified Container.
Example:
        ModLocalDataSetInt ("MyBestMod", "MyKey0", 0)
        ModLocalDataSetInt ("MyBestMod", "MyKey1", 1)
        ModLocalDataSetInt ("MyBestMod", "MyKey2", 2)
        ModLocalDataSetRef ("MyBestMod", "Pastor", PastorClements)
        ModLocalDataSetInt ("MyBestMod", "MyKey4", 4)
        ModLocalDataSetInt ("MyBestMod", "MyKey5", 5)
        ModLocalDataSetString ("MyBestMod", "MyPhrase", "yippee ki yay")
ModLocalDataRemoveAllKeys("MyBestMod") ; all previously set keys will be removed.

-ModLocalDataDumpToConsole(string ModName)
Will dump to console all keys and values for specified ModName(for easier debugging)
Example:
ModLocalDataDumpToConsole ("MyBestMod")

V1.20 ----------------------------------------------------------------------------------------

Each node function has optional parameter iPCRequest. This is only need to be used for  affecting player character. This has no effect on NPCs or Objects.
The player character has two, completely separate 3D models for 1st and 3rdperson. This argument enables to explicitly target one of the models.


Requests are:
1 - for First person model
2 - for Third person model



-(string array)GetNodeChildren(ObjectReference MyRef, string NodeName, int iPCRequest = 0)


Will return children nodes of specified node.

myArray = GetNodeChildren(Game.GetPlayer(), "NPC")


-(int)GetNodeChildrenCount(ObjectReference MyRef, string NodeName, int iPCRequest = 0)

Will return children count of specified node.
Will return -1 if node doesn't exist.

myInt = GetNodeChildrenCount(Game.GetPlayer(), "NPC")


V1.30 ----------------------------------------------------------------------------------------
Excel functions allow you to create\read\modify .xlsx files in in-game folder.
Filename is always specified without extension.


-(bool)ExcelWriteFloat(string sFileName, string sSheetName, int iRow, int iColumn, float Value)
Writes number(float\int) to specified Excel file.

  • if file doesn't exists - it will be created along with folders.
  • if sheet in file doesn't exists - it will be created.
  • File name is specified without extension.
  • Cell row and column indexes start with 1.

ExcelWriteFloat("MyExcel/MyFile", "MySheet",2,1,10)


-(bool)ExcelWriteString(string sFileName, string sSheetName, int iRow, int iColumn, string Value)
Writes string to specified Excel file.

ExcelWriteString("MyExcel/MyFile", "MySheet",1,2,"Sky is beautiful tonight")


-(float)ExcelReadFloat(string sFileName, string sSheetName, int iRow, int iColumn)

Reads numeric value from specified cell of specified Excel file.

ExcelReadFloat("MyExcel/MyFile", "MySheet",1,1)


-(string)ExcelReadString(string sFileName, string sSheetName, int iRow, int iColumn)
Reads numeric value from specified cell of specified Excel file.

ExcelReadString("MyExcel/MyFile", "MySheet",1,2)


-(int)ExcelGetWorkSheetCount(string sFileName)
Returns number of sheets in Excel file.

ExcelGetWorkSheetCount("MyExcel/MyFile")


-(bool)ExcelWorkSheetExists(string sFileName, string sSheetName)
Returns if sheet with specified name exists.

ExcelWorkSheetExists("MyExcel/MyFile", "MyOtherSheet")


-(int)ExcelGetRowCount(string sFileName, string sSheetName)
Returns number of rows of specified sheet in Excel file.

ExcelGetRowCount("MyExcel/MyFile", "MySheet")


-(int)ExcelGetColumnCount(string sFileName, string sSheetName)
Returns number of columns of specified sheet in Excel file.

ExcelGetColumnCount("MyExcel/MyFile", "MySheet")


-(bool)ExcelWorkSheetRename(string sFileName, string sSheetName,string sNewSheetName)
Renames specified sheet to new name.
If sheet doesn't exist - returns false.

ExcelWorkSheetRename("MyExcel/MyFile", "MySheet", "MyBetterSheet")


-(string array)ExcelGetAllWorkSheets(string sFileName)
Returns array of string of all existing Worksheets in the file.

sRes_Ar = ExcelGetAllWorkSheets("MyExcel/MyFile")


-(bool)ExcelEraseCell(string sFileName, string sSheetName, int iRow, int iColumn)

Erases specified cell from specified Excel file.

ExcelEraseCell("MyExcel/MyFile", "MyBetterSheet",1,1)


-(bool)ExcelEraseSheet(string sFileName, string sSheetName)

Erases specified sheet from specified Excel file.

ExcelEraseSheet("MyExcel/MyFile", "MyOtherSheet")


-(int)ExcelGetCellValueType(string sFileName, string sSheetName, int iRow, int iColumn)

Returns value type of specified Cell in specified Excel file.

ExcelGetCellValueType("MyExcel/MyFile", "MyBetterSheet",1,1)


Return types are:
0 - EMPTY;
1 - Boolean;
2 - Integer;
3 - Float;
4 - Error;
5 - String

Example of use:


DebugPrintSUP("ExcelReadFloat from MySheet, Cell 1:1 should return -1>>>" +
ExcelReadFloat("MyExcel/MyFile", "MySheet",1,1)  )
DebugPrintSUP("ExcelWriteFloat to MySheet, Cell 1:1 should return TRUE>>>" +
ExcelWriteFloat("MyExcel/MyFile", "MySheet",1,1,4.5)  )
ExcelWriteFloat("MyExcel/MyFile", "MySheet",2,1,10)
ExcelWriteFloat("MyExcel/MyFile", "MySheet",3,1,10)
ExcelWriteFloat("MyExcel/MyFile", "MySheet",3,2,10)

DebugPrintSUP("ExcelWriteString to MySheet, Cell 1:2 should return TRUE>>>" +
ExcelWriteString("MyExcel/MyFile", "MySheet",1,2,"Sky is beautiful
tonight")  )
DebugPrintSUP("ExcelWriteFloat to MyOtherSheet, Cell 1:1 should return TRUE>>>" + ExcelWriteFloat("MyExcel/MyFile",
"MyOtherSheet",1,1,9.3)  )
DebugPrintSUP("ExcelGetWorkSheetCount to MyOtherSheet, Cell 1:1 should return 2>>>" +
ExcelGetWorkSheetCount("MyExcel/MyFile")  )

DebugPrintSUP("ExcelReadFloat from MySheet, Cell 1:1 should return 4.5>>>" +
ExcelReadFloat("MyExcel/MyFile", "MySheet",1,1)  )
DebugPrintSUP("ExcelReadString from MySheet, Cell 1:1 should return string>>>" +
ExcelReadString("MyExcel/MyFile", "MySheet",1,2)  )
DebugPrintSUP("ExcelReadFloat from MyOtherSheet, Cell 1:1 should return 9.3>>>" +
ExcelReadFloat("MyExcel/MyFile", "MyOtherSheet",1,1)  )
DebugPrintSUP("ExcelWorkSheetExists for MyOtherSheet should return TRUE>>>" +
ExcelWorkSheetExists("MyExcel/MyFile", "MyOtherSheet")  )

DebugPrintSUP("ExcelGetRowCount for MySheet should return 3>>>" + ExcelGetRowCount("MyExcel/MyFile", "MySheet")  )
DebugPrintSUP("ExcelGetRowColumn for MySheet should return 2>>>" + ExcelGetColumnCount("MyExcel/MyFile", "MySheet")  )


DebugPrintSUP("ExcelWorkSheetRename for MySheet, should return TRUE>>>" +
ExcelWorkSheetRename("MyExcel/MyFile", "MySheet", "MyBetterSheet") )
DebugPrintSUP("ExcelWorkSheetRename for MySheet, should return FALSE>>>" +
ExcelWorkSheetRename("MyExcel/MyFile", "MySheet", "MyBetterSheet") )

sRes_Ar = ExcelGetAllWorkSheets("MyExcel/MyFile")

DebugPrintSUP("All sheet names BEGIN, should return MyBetterSheet and MyOtherSheet")
            
currentElement = 0
       while (currentElement < sRes_Ar.Length)
        DebugPrintSUP("Sheet>>>" +   sRes_Ar[currentElement] )
             currentElement += 1
       endWhile
DebugPrintSUP("All sheet names END")

DebugPrintSUP("ExcelGetCellValueType to MyBetterSheet, Cell 1:1 should return 3>>>" +
ExcelGetCellValueType("MyExcel/MyFile", "MyBetterSheet",1,1)  )
DebugPrintSUP("ExcelGetCellValueType to MyBetterSheet, Cell 1:2 should return 5>>>" +
ExcelGetCellValueType("MyExcel/MyFile", "MyBetterSheet",1,2)  )

DebugPrintSUP("ExcelEraseCell to MyBetterSheet, Cell 1:1 should return TRUE>>>" +
ExcelEraseCell("MyExcel/MyFile", "MyBetterSheet",1,1)  )
DebugPrintSUP("ExcelGetCellValueType to MyBetterSheet, Cell 1:1 should return 0>>>" +
ExcelGetCellValueType("MyExcel/MyFile", "MyBetterSheet",1,1)  )



DebugPrintSUP("ExcelEraseSheet to MyOtherSheet,  should return TRUE>>>" +
ExcelEraseSheet("MyExcel/MyFile", "MyOtherSheet")  )

sRes_Ar = ExcelGetAllWorkSheets("MyExcel/MyFile")

DebugPrintSUP("All sheet names BEGIN, should return ONLY MyBetterSheet ")
            
currentElement = 0
       while (currentElement < sRes_Ar.Length)
        DebugPrintSUP("Sheet>>>" +   sRes_Ar[currentElement] )
             currentElement += 1
       endWhile
DebugPrintSUP("All sheet names END")


V2.00 ----------------------------------------------------------------------------------------
-(bool) IsSUPDateCheckerLoaded()
Returns whether SUPDateChecker is loaded.

-(string) GetNexusModVersionAPI(int iNexusModID)
Returns current version of mod hosted on Nexus.
For this function to work you should check if "SUPDate Checker" is loaded and IsNexusAPIKeyValid returns true.
If there's internet access error or invalid iNexusModID - function will return "ERROR" as a string result;

GetNexusModVersionAPI(47359)
Will return current version of Buffout 4.

-(bool)IsNexusAPIKeyValid()
Returns whether user NexusAPIKey is valid.
For this function to work you should check if "SUPDate Checker" is loaded.


-(void) OpenNexusModPage(int iNexusModID)
Opens Nexus mod page by specified mod ID.The page will be opened by default browser.
OpenNexusModPage(47359)

-(int) GetSUPDateCheckerCurrentStage()
-Get current stage of SUPDate Checker.

-(int) GetSUPDateCheckerDoneStage()
Returns end stage when SUPDateChecker has finished working(to compare with value from GetSUPDateCheckerCurrentStage)

-(string) Function GetGitHubLatestReleaseTag(string sGitHubPath)
Returns latest tag(version) of specified github latest release repo.  SUPDate Checker or Nexus API key are not needed to execute this function.

Example:
GetGitHubLatestReleaseTag("ModOrganizer2/modorganizer")

Will return latest release of  ModOrganizer2.

Article information

Added on

Edited on

Written by

TommInfinite

0 comments