I'm sorry for the weird title. What this is about is a quick tutorial on how to create a script that will do one thing if the user of your mod has SKSE installed, and something else if they don't. I might include this in the Common Modding Questions post as well, but I thought this deserved its own post. It's a fairly simple process, but one that could help add a lot of functionality to your mod without having it require SKSE.
I'm going to give you a skeleton of a script now, so you can understand the basic structure of a script that would execute one thing or another depending on whether or not the user has SKSE installed. If you simply copy and paste it, the CK or whatever your compiler is will spit out errors, so don't copy it yet. Here it is, with helpful notes explaining its parts hidden behind colons:
Int SKSEVersion = 0; this sets an integer variable which we will later use to check if SKSE is installed
Event MyEvent(); you would insert whatever event you're using in your script here, along with the proper parameters
SKSEVersion = SKSE.GetVersion(); sets our variable to whatever version the user has of SKSE. If they don't have SKSE, it will cause a Papyrus log error, but one that is completely fine and won't crash anything, and will cause SKSE version to be 0 (not installed)
If SKSEVersion > 0; if SKSE.GetVersion() returned a number larger than 0, then do something. This means SKSE has been installed, so you would put what you wanted to happen if SKSE was installed here.
;do stuff
Else; if SKSEVersion was equal to 0, meaning SKSE wasn't installed
;do other stuff
EndIf
EndEvent
You should probably be able to figure out how to use the script from the notes, but I'll give an example anyway. Let's say I want to give the player an iron sword when they've killed a creature, and then set the speed of the iron sword to half the player's height. Since we can only do the latter part if you use SKSE, we'll have the player get a steel sword if they don't have SKSE, or the modified iron sword if they do. Our script would look like this:
Scriptname MySKSEScript Extends Actor; this is attached to the creature our valiant player must defeat
Weapon Property SteelSword Auto
{Non-SKSE Sword}
Weapon Property IronSword Auto
{SKSE Sword}
Int SKSEVersion; is SKSE installed? This variable will check
Event onDying(Actor AkKiller); I've always preferred OnDying to OnDeath, since I've had issues with OnDeath before
SKSEVersion = SKSE.GetVersion(); explanation of this in the skeleton script above
If SKSEVersion > 0;if SKSE is installed
Float PlayerHeight = Game.GetPlayer().GetActorBase().GetHeight(); we call the SKSE function GetHeight on the ActorBase of the player, since it's a function on the ActorBase script, to get the height of the player
IronSword.SetSpeed(PlayerHeight/2); set the speed of IronSword to half the player's height
Game.GetPlayer().AddItem(IronSword); add the modified IronSword
Else; if SKSE isn't installed
Game.GetPlayer().AddItem(SteelSword); add the boring steel sword
EndIf
EndEvent
So now you know how to create bits of code that execute only if SKSE is installed. It's an elegant solution to the battle between SKSE's functionality and the few mod users left who don't have SKSE and don't want it (it might not be that dramatic or elegant, but drama adds to things). If you've got any questions, please leave them in the comments below.