Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

doticu

Uploaded by

doticu

Virus scan

Safe to use

About this mod

A C++ Papyrus library that helps to optimize scripts. When a player has this plugin installed, mod developers can take advantage of getters, filters, sorters, and more, to make their mods more efficient, performant, and stable.

Requirements
Permissions and credits
Mirrors
Changelogs
I now accept donations on my website!
-------


For Players:

A mod developer will direct you to this plugin if their mod can take advantage of it. All you need to do is meet the two requirements, download the plugin, install, and you're ready to go!

For Developers:

When a player has this plugin installed, you can utilize SkyPal's various global scripts to handle large amounts of objects in a single function call. Instead of iterating too many objects in Papyrus and bogging down the game or even worse, dumping stacks, you can use SkyPal to natively execute batch operations for you. Currently, the most developed SkyPal script lets you interact with and handle ObjectReferences in a variety of ways. Checkout the FAQ and the examples sections for more information. You may also wish to check out the GitHub page for the source code.

Requirements:

  • Skyrim SE 1.5.97.0
  • SKSE 2.0.17+ (2.0.19 recommended)

Whenever Bethesda releases a new version of Skyrim, this mod will require an update, just as SKSE does. In that event, you will need to install the updated version when it comes out. For more information, see the FAQ section.

FAQ:

Will you use the Address Library so I don't have to update when Bethesda releases a new version of Skyrim?
Spoiler:  
Show
The Address Library does not work that way. It cannot guarantee that an SKSE Plugin that uses it will work when a new Skyrim version comes out. It cannot guarantee that its ids will remain valid in the next version. You can read more about that on the description page of Address Library. Also, this mod is currently dependent upon SKSE as a static library. The developers of SKSE must update the addresses in their program whenever a new version of Skyrim comes out, and so too must SkyPal.

Will SkyPal be backwards compatible when it has received an update?
Spoiler:  
Show
When an update to SkyPal occurs, there will be a strong attempt to preserve backwards compatibility. In most cases, there is no reason a function or script needs to be removed when we can just add a new one. No function will have its default parameters changed. If any function or script needs to be deprecated, it will be notated in a comment, as well as where to find the alternatives. This approach allows older mods to work with newer versions of SkyPal, so that they remain working even when their developers no longer provide updates.

Can you add this or that function?
Spoiler:  
Show
If there is something you need that SkyPal doesn't have, talk to me and together we can develop an update that will directly assist you and your mod's needs. I may from time to time add functions and global scripts of my own accord that are useful, or exemplify what can be done better, faster, and more stably with SkyPal. However, it's better if you tell me what you actually need, so we can work on real use-cases. Feel free to message me here on Nexus!

Developer Examples:

You can check if the player has correctly installed SkyPal:
Spoiler:  
Show
if SkyPal.Has_DLL()
    ; let's optimize
elseIf This_Mod_Has_A_Fallback()
    ; notify players that we're falling back to the slower method
else
    ; notify players that they did not correctly install SkyPal, and bail
endIf

Also what version they are running:
Spoiler:  
Show
if SkyPal.Has_Version(1, 1, 0, ">=")
    ; player is running 1.1.0+, let's use newer functionality
elseIf SkyPal.Has_Version(1, 0, 0, "==")
    ; player has our fallback version
else
    ; can't use this version of SkyPal, bail.
endIf

Let's combine a filter and sort to greatly improve our efficiency:
Spoiler:  
Show
ObjectReference property player auto

ObjectReference[] function Get_Refs_Near_Player(float distance = 5000.0)
    ; Get all refs currently in the cell grid around the player
    ObjectReference[] grid_refs = SkyPal_References.Grid()

    ; Pass any refs that are less than 'distance' units away from the player
    grid_refs = SkyPal_References.Filter_Distance(grid_refs, distance, player, "<")

    ; Sort them from closest to farthest away from the player
    grid_refs = SkyPal_References.Sort_Distance(grid_refs, player, "<")

    return grid_refs
endFunction

Find a weapon in the player's grid that has one of the keywords, but not both:
Spoiler:  
Show
int property weapon_form_type = 41 autoReadOnly; 'kWeapon' in SKSE's FormType script
Keyword property keyword_a auto
Keyword property keyword_b auto

ObjectReference function Get_Our_Weapon()
    ; Get all refs currently in the cell grid around the player
    ObjectReference[] grid_refs = SkyPal_References.Grid()

    ; Pass any refs that have a base form type of 'weapon_form_type'
    int[] base_form_types = new int[1]
    base_form_types[0] = weapon_form_type
    grid_refs = SkyPal_References.Filter_Base_Form_Types(grid_refs, base_form_types)

    ; Pass only refs that have one or the other keyword, but not both
    Keyword[] keywords = new Keyword[2]
    keywords[0] = keyword_a
    keywords[1] = keyword_b
    grid_refs = SkyPal_References.Filter_Keywords(grid_refs, keywords, "^")

    ; make sure we check for none
    if grid_refs.length > 0
        return grid_refs[0]
    else
        return none
    endIf
endFunction


Special Thanks:

Special thanks goes to IDontEvenKnow for providing SkyPal's first use-case with his excellent and highly recommended mod IHarvest. He also provided assistance and support without which SkyPal would not exist.

Thank you:

  • Bethesda for Skryim, which is such an endearing masterpiece.
  • SSEEdit/TesVEdit/xEdit Team for such an amazing tool.
  • Mod Organizer 2 Team for your indispensable program.
  • SKSE Team for your extender, which has extended the life of the game itself.
  • joelday for papyrus-lang and the excellent guide on how to use the Creation Kit with Mod Organizer 2.
  • fireundubh for your parallel papyrus compiler pyro and the wiki that goes with it.
  • Ryan-rsm-McKenzie of CommonLibSSE for decompiling useful parts of the SkyrimSE engine.
  • meh321 of Address Library for SKSE Plugins for making it easy to get the executable's offsets.
  • Polacode VS Code extension, for making it viable to share a screen shot of the source code.
  • Creation Kit Wiki for the wealth of knowledge with which this mod was made.
  • GitHub for giving my codebase a place to live online.
  • NexusMods for such a great site, and for hosting my mod!
  • testers and developers, for your interest, bug reports, and suggestions to make this mod better and better.
  • my family, for giving me the time, space, and sustenance to make this mod.
  • and every one else who has helped me directly or indirectly, if I have failed to mention you!

Last but not least, a big thank you to all who try out my mod, and to all of you who enjoy it and find value in it.

SkyPal lives on Github!