hextun Posted September 30, 2025 Posted September 30, 2025 First, the wiki link for Function Library Development. This is, in my opinion, the single most important feature of SLTR; the ability for users (possibly mod authors if they were so inclined to provide SLTR support) to wrap up new functions as bindings for SLTScripts. Since it involves Papyrus development, including needing things like "header only" .psc files for builds, I'm going to assume you have some idea of what you're doing in that regard. I can help perhaps with some guidance but by and large you'd need to setup and be at least a little comfortable with Papyrus development. You'll want, at minimum, a header version of `sl_triggersCmd.psc`, so you have access to the required functions, but again, at minimum, it would need a definition for `CompleteOperationOnActor()`. The general idea is this: - sl-triggers.dll, on game start, looks in 'SKSE/Plugins/sl_triggers/extensions/' for all '*-libraries.json' files, and parses them, looking for the Papyrus script names it needs to scan. It also notes their priorities. All function libraries are enabled by default. - For each Papyrus script name it finds, it checks the Skyrim Papyrus VM for that script type and then loops through all of the functions defined - It looks for functions matching the declaration (e.g. 'some_function' in this case): Function some_function(Actor CmdTargetActor, ActiveMagicEffect _CmdPrimary, string[] param) global - During SLTScript execution, when the parser determines that a token represents a function name to be called, the plugin is asked to call the appropriate function - The plugin finds the script where the function is defined via hash lookup and dispatches a static call to the VM with the parameters - At this point sl_triggersCmd is sitting in a loop waiting for completion - Calling sl_triggersCmd.CompleteOperationOnActor() at the end of your function notifies sl_triggersCmd to continue execution So, by simply building your script with appropriately configured functions, and providing the -libraries.json file to point to it, you can add your own functions and even distribute your compiled .pex/-libraries.json combo to others. By way of another example, if you install SLTR with OStim or SexLab selected, it also includes the adult-general library, with function libraries for OSLA and SLIF. The following files, which again would be installed with SLTR if you select OStim or SexLab, would constitute a function library and could have been shipped separately. Note that the *Adapter*.psc files are just helpers for the *CmdLib*.psc files. - SKSE/Plugins/sl_triggers/extensions/sl_triggersCmdLibAdultGeneral-libraries.json - scripts/sl_triggersAdapterOSLA.pex - scripts/sl_triggersAdapterSLIF.pex - scripts/sl_triggersCmdLibOSLAroused.pex - scripts/sl_triggersCmdLibSLIF.pex Put another way, I could fall of the face of the planet, and people could still add new function libraries to expand supported bindings for any mod or any other function you'd want to expose.
Recommended Posts