Jump to content

SL Triggers(v12) [2022-06-05]


Recommended Posts

Posted
3 hours ago, hextun said:

I am but I'm in the middle of a big overhaul. What did you have in mind?

Functions to advance a stage, go back a stage, check if a spell exists on an actor and get the spell duration on an actor.

Posted (edited)
On 4/12/2025 at 8:14 AM, MannySauce said:

Functions to advance a stage, go back a stage, check if a spell exists on an actor and get the spell duration on an actor.

 

Fair warning, it seemed simple enough that I put the functionality in, rebuilt, zipped, and dropped. Version number and CHANGELOG and descriptions did get updated.

 

So 3 out of 4. Stage forward backward was easy enough (new function, "sl_advance", accepts an optional parameter, if "-1", goes backward, otherwise, any other value, it goes forward.

 

And I was able to determine if a spell exists on an Actor easily enough (new function, "sl_isaffectedby", requires a parameter, a Form ID, of either a MGEF or a SPEL. If a SPEL it will iterate its MGEF and check for each one. $$ == "1" if found, "0" otherwise.

 

As for spell duration, not so easy. There are some additional dependencies I can add to dig deeper into Papyrus but as far as I can tell at the moment with the current dependencies I cannot fetch ActiveMagicEffects from an Actor to get the remaining duration. https://www.nexusmods.com/skyrimspecialedition/mods/85252 / https://ck.uesp.net/wiki/ANDR_PapyrusFunctions_Script for example. But it adds a .dll dependency.

 

And finally, to give you an idea of what I've been working on:

sl_triggers_progress.png.48077879b696800dd39cffe5800ab3a8.png

 

EDIT: Removed misleading download link.

 

Edited by hextun
Posted
On 4/11/2025 at 5:55 PM, sirretinee said:

I'm not the best with this kind of scripting so bear with me on this one.
Apologies for the wall of text, i'm trying to be as concise as possible.
How exactly would these apply... at all?
Does 'Is Player' specifically target the player character or does it target actor 1/2/etc.?
These look like they only trigger depending on who/what an actor is, not on the actor's position in an animation.

Let me bring up a random animation as an example:
image.png.1760dde1e39c78e90fd4ff6f809b2a34.png
It doesn't matter who or what actors in this example are (blue boxes), what matters is what position they are in (red boxes).
'actor1' could be anything, and it looks like you've given us ample tools to do things to an actor based on what 'actor1' is.
I'm not looking for what 'actor1' is, though, i'm just looking for if an actor in an animation is 'actor1'.

This is what i've got for my scaling script:
image.png.6fa2bb5bbeb9a744dcd4f4f8a1f8d097.png
It runs on every animation involving a male (probably a better way to do this, again, bear with me).
This immediately fails if the 'bigguy' is not male. If both characters are female, nobody gets scaled.
Now I could just run the script under the same conditions except for females instead of males.
Except that'd scale both characters as they're both female (this is assuming the 'receiver' is female in both cases).
However, I could also have it check if the player is involved in the animation. If the PC is the intended 'giver' scale the player and not the parter.
Double however, if I wanted to swap positions and have the PC be the 'receiver' in an animation, i'd need to somehow run a separate trigger for scaling the player partner ('giver') without triggering the other player-scaling trigger.
Triple however, both of those also fall apart if the two actors are npcs.
It's all just a whole lotta hooplah to figure out who is in what slot and what to do with them when the solution we're seeking is to just apply the scale to, in this case, the giver, AKA actor2.



TLDR: Is an actor a nord? Werewolf? Male, female, or futa? Player character or NPC? Purple or green? Stormcloak or Imperial? Milk-drinker or mead enjoyer? Irrelevant.
All we want to know is if they're actor1 or actor2 (or actor3/actor4/etc.).
As the guy I quoted suggested, an expansion on the 'if actor' selection in the MCM also had options for specific animation slots is what we're looking for.

 

I clearly misunderstood the ask. So, to boil it all down, what you would like is:

is_actor_position: dropdown (position 1, position 2, position 3, position 4)

true: for actors in specified position

Posted
9 hours ago, hextun said:

 

I clearly misunderstood the ask. So, to boil it all down, what you would like is:

is_actor_position: dropdown (position 1, position 2, position 3, position 4)

true: for actors in specified position

Yes, that'd be perfect.

All of the various size-based animations are consistent as far as which actor needs to be scaled, so being able to scale based on actor position instead of trying to determine which actor is which through various checks would save a ton of headaches.

Posted (edited)

New release. 

 

IMPORTANT: v19 fixes a bug introduced in v16. If you are currently running v16, v17, or v18, please update to v19 (or revert to an older version) with my apologies. During the refactoring I switched some code to use int instead of string but botched it. The problem is fixed now and I tested it to make sure. It's my fault for lack of thorough testing.

 

In addition to the bugfix, this release introduces a new trigger option, "if_position", which lets you choose whether to run the trigger based on an Actor's position (1-based) in a scene.

 

Additionally, because I code before thinking, you now have a new operation, "sl_isinposition". Can you guess what it does? I made that before remembering that wasn't the ask and figured why not leave it in. So you have both now. Of course, sl_isinposition can be used to test against any actor and multiple slots on a single command, so it's not entirely without merit.

 

And some stuff to help make your settings file a little cleaner when you set a trigger to no longer specify an event.

 

19
	enhancement: new operation
		- sl_isinslot - is the specified actor in the specified slot of a SexLab scene (I accidentally implemented this and kept it)
			["sl_isinslot", "$self", "1"]
				$$ == "1" if true; "0" otherwise
	enhancement: new trigger criteria: is_position (is the actor in the indicated slot; what I was asked for)
	enhancement: setting events back to "Select an Event" clears out the event, helping keep your settings.json cleaner
	bugfix: Main no longer skipping most of the checks due to my switch to int conversion and not paying attention to !
	bugfix: SexLab event handling no longer goes into an infinite loop (present since v16)
	change: brought in "whatsnew" to consolidate change history

 

 

EDIT: Removed misleading download link.

Edited by hextun
Posted
6 minutes ago, MannySauce said:

Thanks a lot for the updates, seriously, I've needed sl_advance and sl_isaffectedby for so long.

Appriciated him!

Posted (edited)
On 4/14/2025 at 10:22 AM, MannySauce said:

A lil' bug report, the chance part of the trigger doesn't seem to be working? I just set one to 0% for testing, but it still triggered 100% of the time.

 

Good god, y'all. And not in the cool James Brown kind of way.

 

Okay, here is a v20 that has that fixed.

 

Verified this specifically before posting. :(

 

EDIT: Removed misleading download link. 

Edited by hextun
Posted

Also have a bug report about the new position conditions.
When setting 'if scene position' to 1, closing and re-opening the MCM, 'if scene position' reverts back to 'any' and 'if actor' changes to 'aggressor'.

Mid-post update:
While trying to get screenshots to help with this, something occured to me.
'Aggressor' is the first option under 'if actor', so I set 'if scene position' to 2, closed and re-opened the MCM, and 'if actor' changed to 'victim', which is the second option under 'if actor'.
Looks like some wires are being crossed.
 

Posted (edited)
On 4/14/2025 at 3:35 PM, sirretinee said:

Also have a bug report about the new position conditions.
When setting 'if scene position' to 1, closing and re-opening the MCM, 'if scene position' reverts back to 'any' and 'if actor' changes to 'aggressor'.

Mid-post update:
While trying to get screenshots to help with this, something occured to me.
'Aggressor' is the first option under 'if actor', so I set 'if scene position' to 2, closed and re-opened the MCM, and 'if actor' changed to 'victim', which is the second option under 'if actor'.
Looks like some wires are being crossed.
 

 

Fixed. When I had added "position" I copied "role" and forgot to change the attribute id from 4 to the new value of 16. :( It would change the "role". I had a trigger already set up, so the MCM failure didn't affect me during testing.

 

Thank you for the detective work. :) 

 

EDIT: Removed misleading download link.

Edited by hextun
Posted

I've put the project up on github: https://github.com/lynnpye/sl_triggers

 

I've only set tags and releases for v12 and v21 but will keep the trend going.

 

Aside from needing to install a PapyrusCompiler (which Skyrim ships with) and your desired copy of the SKSE source scripts, I think it should include all other "include" headerfied .psc files in a subfolder, so the associated "build" and "assemble" scripts should work out of the box otherwise. You'll have to tweak a couple of environment variables for the aforementioned locations. For what it's worth, this isn't my normal development setup but I wanted to make something specific to the project that others could easily use if they wanted.

 

"assemble" requires 7z in your path too (whoops), and requires a version number as an argument, e.g.:

 

  assemble 21

Posted

Ordinarily silence is golden, but given the recent instability, if anyone could chime in with how v21 is faring for you, I would be much obliged. :)

 

Also, if anyone is in a code reviewing mood, I wouldn't mind feedback on the 'extensions' branch.

Posted
3 hours ago, hextun said:

Ordinarily silence is golden, but given the recent instability, if anyone could chime in with how v21 is faring for you, I would be much obliged. :)

 

Also, if anyone is in a code reviewing mood, I wouldn't mind feedback on the 'extensions' branch.

The 'console' function, like ["console","$player","resethealth"], seems to have stopped working after I updated from v19 to v21.

 

Also while not a bug, I've got a nitpick with 'msg_notify' - I'm using it to report faction rank changes made with 'actor_setfactionrank' and 'inc', but instead of printing for example 7, I get 7.00000 or however many zeroes IDK.

 

That's all I've bumped into, thanks again for sl_advance.

Posted
25 minutes ago, MannySauce said:

The 'console' function, like ["console","$player","resethealth"], seems to have stopped working after I updated from v19 to v21.

 

Also while not a bug, I've got a nitpick with 'msg_notify' - I'm using it to report faction rank changes made with 'actor_setfactionrank' and 'inc', but instead of printing for example 7, I get 7.00000 or however many zeroes IDK.

 

That's all I've bumped into, thanks again for sl_advance.

 

I'll have a look. I was working with scrab on something I ran across with ConsoleUtil Extended and had some test code in the console function, but I thought I had removed that.

 

I'll also take a look at the formatting. I suspect that it won't be simple.

Posted (edited)
On 4/15/2025 at 3:20 PM, MannySauce said:

The 'console' function, like ["console","$player","resethealth"], seems to have stopped working after I updated from v19 to v21.

 

Also while not a bug, I've got a nitpick with 'msg_notify' - I'm using it to report faction rank changes made with 'actor_setfactionrank' and 'inc', but instead of printing for example 7, I get 7.00000 or however many zeroes IDK.

 

That's all I've bumped into, thanks again for sl_advance.

 

Looks like it was a misbundling. I've removed the old "v21" and am attaching a proper copy here.

 

 

EDIT: Removed misleading download link

Edited by hextun
Removed bad download link
Posted (edited)

Hi, thank you for the fantastic mod.

 

Is there a way to do the following? calculate duration of Sexlab scene & track orgasm from player not player? (both)

My goal is to execute a script based on Orgasm Y/n by actor + duration of scene.


I was thinking about several possibilities:

  • use SLSO orgasm as trigger, then wait inside the script to track time. I've tried this but it doesn't work. which makes sense, the script is triggered when the SLSO orgasm happens, so it doesn't track the duration of the scene before.
  • use BEGIN as trigger then get time to track, and trigger script effects upon orgasm by player or actor (I have no idea how to do this). ideally track orgasm count as well

 

Thanks in advance for your tips!

 

edit: running triggers 12 currently, will try to upgrade but please let me know if you have ideas!

Edited by Fraying9981
Posted
On 4/15/2025 at 12:41 PM, hextun said:

Ordinarily silence is golden, but given the recent instability, if anyone could chime in with how v21 is faring for you, I would be much obliged. :)

 

Also, if anyone is in a code reviewing mood, I wouldn't mind feedback on the 'extensions' branch.

I've run into two a problems, actually.
It was two problems, but i'm a goober and noticed I had a debug message in the wrong spot so I might've been getting incorrect feedback while writing this up.

This is my scaling script:
image.png.2e2a2856d9251d5752162578bfe8db83.png
I'm now realizing the "Is in slot" message doesn't actually trigger after the check is performed, which is where it'd actually be helpful.
However, ignoring all that, neither actor was being scaled despite the trigger running for both actors: (could still be an issue with the "console" command?)
image.png.ec99217e69a62256a11468ba0c70dc0b.png


2. The MCM is hitting me with this:
image.png.c54361ffddf074b823d794b0dab29bb5.png
None of my scripts are firing now.
New save, new character, new sl_triggers.
Even my older version of sl_triggers is bugging out now, it's the damndest thing.

Posted (edited)
2 hours ago, sirretinee said:

I've run into two a problems, actually.
It was two problems, but i'm a goober and noticed I had a debug message in the wrong spot so I might've been getting incorrect feedback while writing this up.

This is my scaling script:
image.png.2e2a2856d9251d5752162578bfe8db83.png
I'm now realizing the "Is in slot" message doesn't actually trigger after the check is performed, which is where it'd actually be helpful.
However, ignoring all that, neither actor was being scaled despite the trigger running for both actors: (could still be an issue with the "console" command?)
image.png.ec99217e69a62256a11468ba0c70dc0b.png


2. The MCM is hitting me with this:
image.png.c54361ffddf074b823d794b0dab29bb5.png
None of my scripts are firing now.
New save, new character, new sl_triggers.
Even my older version of sl_triggers is bugging out now, it's the damndest thing.

 

So, to be clear, even the older sl_triggers with a new save is bugging out?

 

EDIT: I downloaded the v21 a couple of posts up, installed it to a fresh game, set up a keymap event that called "Give Gold (10)" and also a custom script that used a console command to give myself 83 gold. Both ran successfully, including after quitting to desktop and reloading.

 

I'm not sure what's going on. If you're up to date I'm surprised the console command isn't working, on top of the triggers not working.

 

What happens if you try older saves?

 

Edited by hextun
Posted
11 hours ago, sirretinee said:

I've run into two a problems, actually.
It was two problems, but i'm a goober and noticed I had a debug message in the wrong spot so I might've been getting incorrect feedback while writing this up.

This is my scaling script:
image.png.2e2a2856d9251d5752162578bfe8db83.png
I'm now realizing the "Is in slot" message doesn't actually trigger after the check is performed, which is where it'd actually be helpful.
However, ignoring all that, neither actor was being scaled despite the trigger running for both actors: (could still be an issue with the "console" command?)
image.png.ec99217e69a62256a11468ba0c70dc0b.png


2. The MCM is hitting me with this:
image.png.c54361ffddf074b823d794b0dab29bb5.png
None of my scripts are firing now.
New save, new character, new sl_triggers.
Even my older version of sl_triggers is bugging out now, it's the damndest thing.

 

That the MCM is working but not detecting DAK and SL suggests to me that for some reason either the MCM isn't seeing the Main quest (which is where those settings are stored and accessed) or the Main quest script has stopped receiving update events. 

If you are using ConsoleUtil Extended or have a mod like Custom Console (which is no longer available from Nexus), it gives the ability to create a .psc script with nothing but global functions and create an in-game console command you can run.

I personally prefer CUE because it combines ConsoleUtil functionality (it also provides the same ConsoleUtil script and .dll hooks as the "other" ConsoleUtil mods) with the CustomConsole functionality.

If you have that setup or are willing to do so (switching to CUE was an easy drop-in replacement for me for ConsoleUtilSSE-NG), I can write a script to have a look at the SLT objects in your game session. I would print out any diagnostic information I can think of that may be relevant and possibly perform corrections. It's the only way I can think of to effectively perform surgery on your save. :/

Posted
13 hours ago, hextun said:

 

So, to be clear, even the older sl_triggers with a new save is bugging out?

 

EDIT: I downloaded the v21 a couple of posts up, installed it to a fresh game, set up a keymap event that called "Give Gold (10)" and also a custom script that used a console command to give myself 83 gold. Both ran successfully, including after quitting to desktop and reloading.

 

I'm not sure what's going on. If you're up to date I'm surprised the console command isn't working, on top of the triggers not working.

 

What happens if you try older saves?

 

When I said 'older versions aren't working' I was apparently a dingus and overwrote my old sl_triggers with v20, which is how I was testing the 'actor position' MCM settings/commands.
Fresh install of v21 and i'm getting the non-detection errors in the MCM.
Fresh install of v12 and it runs just fine.
Old install of v12 overwritten with v20 worked until I installed v21 separately, which didn't work, and now that old v12-but-now-v20 doesn't work.

Upgrading to v21 is where things started going south, apparently.

Whether that means scaling and, by extension, console commands, or sl_triggers as a whole.

My saves are not precious to me so I don't really have an older save to compare things to, unfortunately.
I did switch over to CUE, so if you have any ideas, throw them my way.

I'm not missing any requirements, am I? DAK and Sexlab are now, technically optional?
Just to confirm, what all is required/what is the install order one should follow to get sl_triggers working?

Posted
1 hour ago, sirretinee said:

When I said 'older versions aren't working' I was apparently a dingus and overwrote my old sl_triggers with v20, which is how I was testing the 'actor position' MCM settings/commands.
Fresh install of v21 and i'm getting the non-detection errors in the MCM.
Fresh install of v12 and it runs just fine.
Old install of v12 overwritten with v20 worked until I installed v21 separately, which didn't work, and now that old v12-but-now-v20 doesn't work.

Upgrading to v21 is where things started going south, apparently.

Whether that means scaling and, by extension, console commands, or sl_triggers as a whole.

My saves are not precious to me so I don't really have an older save to compare things to, unfortunately.
I did switch over to CUE, so if you have any ideas, throw them my way.

I'm not missing any requirements, am I? DAK and Sexlab are now, technically optional?
Just to confirm, what all is required/what is the install order one should follow to get sl_triggers working?

 

My most minimal testing setup is using Skyrim Modding Essentials plus sl_triggers. No DAK, no SexLab. So technically, yes, they should be optional. Of course, you're using SexLab functions and events so, obviously still a requirement for your purposes. As for load order, no particular order. sl_triggers isn't overriding any scripts and should find the SexLab and/or DAK dependencies automatically as needed. If you are concerned about timing I would suggest placing it later in your plugin order as that might ensure SexLab is ready for event registration when sl_triggers starts up (again, not that I would expect that to be an issue, but as a precaution this would be my suggestion).

 

As for v21, I had posted a version, then took it down and posted a new copy (instead of giving a new version bump; poor choice on my part though I was just thinking of it as a hotfix; I'm not used to forums as a method of distribution) with this post: 

. Out of curiosity, did you redownload that copy of v21 or are you still using the copy from my first upload? If you have not redownloaded the updated v21, please try that.

 

When I get home I'll look into it more.

 

If anyone else is lurking and can chime in, are you having a similar issue?

Posted
5 minutes ago, hextun said:

If anyone else is lurking and can chime in, are you having a similar issue?

 

not sure it applies strictly to the current problem, but I'm trying to write my own scripts with SL triggers, and I'm a bit confused because sometimes they get triggered, sometimes they do not.
I'm using SL v12

 

Here is an example. I set the trigger to Begin - any for everything else - 100%.

So this is just messages to the user when a scene starts - nothing crazy. Yet it fails to trigger 100% of the time.

 

Spoiler


 

{
	"cmd" : 
	[
        ["msg_notify", "[Fuzoku] Begin START..."],

        ["actor_name", "$partner"],
        ["set", "$0", "$$"],

        ["actor_getrelation", "$self", "$partner"],
        ["set", "$1", "$$"],
        ["if", "$1", "=", "4", "lover"],
        ["if", "$1", "=", "3", "ally"],
        ["if", "$1", "=", "2", "confidant"],
        ["if", "$1", "=", "1", "friend"],
        ["if", "$1", "=", "0", "acquaintance"],
        ["goto", "end"],
        
        [":", "lover"],
        ["msg_notify", "$0", " is devoted to you. They'd pay any price for your time and have connections that could elevate your status."],
        ["goto", "end"],
        
        [":", "ally"],
        ["msg_notify", "$0", " is a faithful client. Don't disappoint and you might get rewarded. Unload these balls, they are made of gold."],
        ["goto", "end"],
        
        [":", "confidant"],
        ["msg_notify", "$0", " is a somewhat regular. They know what they want and expect decent service."],
        ["goto", "end"],
        
        [":", "friend"],
        ["msg_notify", "$0", " has had you in the past. You don't really like them, but you have to do your job."],
        ["goto", "end"],
        
        [":", "acquaintance"],
        ["msg_notify", "$0", " is a new client! Or, you never managed to create a lasting impression in the past and they don't care. You must be desperate."],
        
        [":", "speech_check"],
        ["util_wait", "3"],
        ["av_get", "$player", "Speech"],
        ["set", "$5", "$$"],
        ["if", "$5", ">=", "100", "speech_100"],
        ["if", "$5", ">=", "90", "speech_90"],
        ["if", "$5", ">=", "80", "speech_80"],
        ["if", "$5", ">=", "70", "speech_70"],
        ["if", "$5", ">=", "60", "speech_60"],
        ["if", "$5", ">=", "50", "speech_50"],
        ["if", "$5", ">=", "40", "speech_40"],
        ["if", "$5", ">=", "30", "speech_30"],
        ["if", "$5", ">=", "20", "speech_20"],
        ["if", "$5", ">=", "10", "speech_10"],
        ["goto", "speech_0"],
        
        [":", "speech_100"],
        ["msg_notify", "$0", " finds you attractive like a goddess incarnate."],
        ["goto", "end"],
        
        [":", "speech_90"],
        ["msg_notify", "Your irresistible presence has ", "$0", " utterly mesmerized."],
        ["goto", "end"],
        
        [":", "speech_80"],
        ["msg_notify", "Your allure has ", "$0", " thinking about you long after they leave."],
        ["goto", "end"],
        
        [":", "speech_70"],
        ["msg_notify", "Your seductive skills have ", "$0", " completely captivated."],
        ["goto", "end"],
        
        [":", "speech_60"],
        ["msg_notify", "Your charm makes ", "$0", " noticeably excited to be with you."],
        ["goto", "end"],
        
        [":", "speech_50"],
        ["msg_notify", "You're attractive enough that ", "$0", " gives you a second glance."],
        ["goto", "end"],
        
        [":", "end"],
        ["msg_notify", "[Fuzoku] Begin END..."]

	]
}


 

Posted (edited)

Okay, new drop, v22. Fixed the bug. 

 

EDIT: Just wanted to point out that a new save should not be required.

 

When I decoupled SexLab, I created the function to update its status but I did not actually add the call to it (i.e. at the same spot I call UpdateDAKStatus() if you've been looking at source code, inside Main.on_reload()).

 

You may be wondering how I could possibly say I tested it when clearly the mod would not detect SexLab. Well, my non-SexLab MO2 setup launches very quickly. I wouldn't have time to get up and get a glass of water and I can be in the Helgen starting cave. But my SexLab MO2 setup was just a Nef modlist that I could make use of. But it launches very slowly, so I was reusing a save and not reinstalling from scratch.

 

Quest scripts, among other things, like sl_triggersMain, will keep script instance variables in memory across saves. Instance variables like a variable holding a reference to the SexLab framework. Variables that would still be populated when I upgraded to my new "SexLab is now a soft dependency, look, I detected it" version which, in fact, had detected nothing but instead had looked around and seen SexLab standing in the same room awkwardly wondering why today sl_triggersMain looks a little different.

 

So... thank you to @Fraying9981; you kind of pointed me in the right direction, so thank you for chiming in. And I now have a pristine SexLab based save, sans sl_triggers, that I can use as a testing base. Once again, very sorry for the disturbance.

 

Also, I removed some trigger cleanup code I had added in a perhaps aggressive attempt at QoL enhancements. I've seen nothing to suggest it is or might have been causing any sort of problems, but in light of recent events I would prefer to err on the side of stability for now.

Edited by hextun
Removed unavailable download link

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...