Jump to content

[SOLVED] Soft-linking to SL (to start a scene) without making it a hard requirement?


Blaze69

Recommended Posts

Basically what the title says. I would like to know if it's possible to "soft-link" to SexLab as it can be done with other mods.

 

I know some SL data/events/functionality/whatever can be accessed without making it a hard requirement/dependency of the plugin in question, but I'm not sure if starting scenes is part of such functionality. Normally I would do some research before posting, but the SL GitLab page is down, and a quick search has only yielded a "quick 'n dirty" guide to start a scene that requires adding SexLab.esm as a master for the plugin. So I figured it would be both easier and faster to post my question straight away.

 

The thing is, I would like to set the scripts up in such a way that if SL is installed and detected, selecting a specifc dialogue option will trigger a scene (ideally with control over tags and such); but without making SL a hard requirement. Thus, if SL is not installed, the dialogue won't trigger anything and will work as any other non-scripted line instead.

 

A simple "yes" or "no" will suffice, but if it's indeed possible, having some example or reference script would be very helpful :shy:.

 

Thanks in advance.

 

EDIT: Scroll down for some info on how to do this.

Link to comment

Like a modevent? That would be nice... but a lot of work to implement all the controls necessary. I can't imagine how making a modevent for threads would work... but I'd like to have it too actually.

Heard of modevents before, but I wasn't sure whether they were the only way to soft-link. I assume there is no way to trigger SL without making it a requirement, then?

Link to comment

 

Like a modevent? That would be nice... but a lot of work to implement all the controls necessary. I can't imagine how making a modevent for threads would work... but I'd like to have it too actually.

Heard of modevents before, but I wasn't sure whether they were the only way to soft-link. I assume there is no way to trigger SL without making it a requirement, then?

 

 

Not currently. At least, not that I'm aware.

 

There are other ways than modevents to soft-link some things. I prefer modevents - they're more hassle for the person setting them up, but easier for the person actually using them. I'm not familiar enough with how Sexlab works to be able to say for sure what way would work, or whether it's even possible. My guess is probably yes, but that's mostly just a guess.

Link to comment

probably yes, you will need to make skse plugin

 

no...but...you can make optional scripts

a)main script ->utility script -> sexlab

b)main script ->utility script -> nothing

 

user would need to select correct script during install

mod might give error and still work if user chooses to install SL but not actually having SL, but that would probably end badly

this WILL turn bad if 2 mods try do this

 

you can see how its done in MME or DW

Link to comment

Not currently. At least, not that I'm aware.

 

There are other ways than modevents to soft-link some things. I prefer modevents - they're more hassle for the person setting them up, but easier for the person actually using them. I'm not familiar enough with how Sexlab works to be able to say for sure what way would work, or whether it's even possible. My guess is probably yes, but that's mostly just a guess.

Figures. Was worth asking, at least. Unless someone comes along and posts a way to do it, even if it's a bit complex/convoluted, that is. But I won't keep my hopes up.

 

Thank you for the quick reply anyway :shy:.

 

EDIT:

probably yes, you will need to make skse plugin

 

no...but...you can make optional scripts

a)main script ->utility script -> sexlab

b)main script ->utility script -> nothing

 

user would need to select correct script during install

mod might give error and still work if user chooses to install SL but not actually having SL, but that would probably end badly

this WILL turn bad if 2 mods try do this

 

you can see how its done in MME or DW

SKSE is a no. I'm barely capable of doing anything with Papyrus, how the hell am I supposed to program in C++ (or whatever language SKSE plugins use).

 

Wouldn't creating a SL-version of the script require adding SL as a master to the plugin anyway? As far as I know, the main SL quest needs to be set up the script properties for its functions to be called, so even if I create those two versions of the script, one of them would require a special plugin with SL as a master. Or am I getting it wrong?

 

I guess I'll take a look at those mods, too.

Link to comment

no

SexLabFramework SexLab = Game.GetFormFromFile(0x........., "SexLab.esm") as SexLabFramework
or
SexLabFramework SexLab = Quest.GetQuest("SexLabQuestFramework") as SexLabFramework
is enough
 
properties are ahem... for other stuff, like when you need to get something from script into your dialogue as condition, which can also be done with scripts but not so pretty

for example MME_SLA plugin

when sla plugin not installed - nothing happens:

Function UpdateActorExposure(Actor akActor, Int value)
EndFunction

when plugin installed we modify actor exposure rate:

Function UpdateActorExposureRate(Actor akActor, Float value)
	slaFrameWorkScr sla = Quest.GetQuest("sla_Framework") as slaFrameWorkScr
	sla.UpdateActorExposureRate(akActor, value)
EndFunction

Link to comment

no

SexLabFramework SexLab = Game.GetFormFromFile(0x........., "SexLab.esm") as SexLabFramework
or
SexLabFramework SexLab = Quest.GetQuest("SexLabQuestFramework") as SexLabFramework
is enough

Wait a minute. The Hoodies schlong system I use for my race mod already does a GetModFromFile to check if SL is installed. As far as as I know, if it isn't there, the log throws an error, but it's harmless otherwise. It goes like so:

SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework
if SL
	RegisterForModEvent("AnimationStart", "OnSexLabAnimationStart")
	RegisterForModEvent("AnimationEnd", "OnSexLabAnimationEnd")
endif

Say, for example, I start with that, but inside the "if" statement I call a function that uses GetModFromFile to get the SL quest, and then I set up the whole scene. Something like this (note that this is only pseudo code to explain myself:

SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework
if SL
	StartSLScene()
endif

[...]

Function StartSLScene()
	SexLabFramework SexLab = Quest.GetQuest("SexLabQuestFramework") as SexLabFramework

	[Stuff required to start a SL scene]

EndFunction

I assume I would need to have SL and its source scripts installed in order to be able to save and compile the script, but wouldn't this mean if the user doesn't have SL, all that happens is that first error in Line 1 without any further bugs or issues? Or does the [stuff required to start a SL scene] part require script properties (and thus hard dependency)?

Link to comment

 

no

SexLabFramework SexLab = Game.GetFormFromFile(0x........., "SexLab.esm") as SexLabFramework
or
SexLabFramework SexLab = Quest.GetQuest("SexLabQuestFramework") as SexLabFramework
is enough

Wait a minute. The Hoodies schlong system I use for my race mod already does a GetModFromFile to check if SL is installed. As far as as I know, if it isn't there, the log throws an error, but it's harmless otherwise. It goes like so:

SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework
if SL
	RegisterForModEvent("AnimationStart", "OnSexLabAnimationStart")
	RegisterForModEvent("AnimationEnd", "OnSexLabAnimationEnd")
endif

Say, for example, I start with that, but inside the "if" statement I call a function that uses GetModFromFile to get the SL quest, and then I set up the whole scene. Something like this (note that this is only pseudo code to explain myself:

SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework
if SL
	StartSLScene()
endif

[...]

Function StartSLScene()
	SexLabFramework SexLab = Quest.GetQuest("SexLabQuestFramework") as SexLabFramework

	[Stuff required to start a SL scene]

EndFunction

I assume I would need to have SL and its source scripts installed in order to be able to save and compile the script, but wouldn't this mean if the user doesn't have SL, all that happens is that first error in Line 1 without any further bugs or issues? Or does the [stuff required to start a SL scene] part require script properties (and thus hard dependency)?

 

form SL = Game.GetFormFromFile(0xD62, "SexLab.esm")

 

no, since you actually try to run sexlab functions user will get an papyrus log error  like 

Cannot open store for class "SexLabFramework", missing file? 

and then most likey skyrim will decide that its bad and fuck this script and all other scripts that link to it

 

therefore you need a middle script that can be easily switched w/o changing whole mod

Link to comment

form SL = Game.GetFormFromFile(0xD62, "SexLab.esm")

 

no, since you actually try to run sexlab functions user will get an papyrus log error  like 

Cannot open store for class "SexLabFramework", missing file? 

and then most likey skyrim will decide that its bad and fuck this script and all other scripts that link to it

 

therefore you need a middle script that can be easily switched w/o changing whole mod

Wait a minute (again, lol  :unsure:).

 

If you continue reading the script for the Hoodies quest, you get to this point:

if SL
	if SL.IsActorActive(theActor)
		sslThreadController tc = SL.GetActorController(theActor)
		if tc
			int g = SL.getGender(theActor)
			sslActorAlias a = tc.ActorAlias(theActor)
			if a && a.MalePosition
				DebugLog("(EquipSchlong) Actor: " + theActor + " is pitching, keeping erection")
				erectionLevel = 9
			elseIf g == 1 || g == 3
				DebugLog("(EquipSchlong) Actor: " + theActor + " is a female receiving, no erection")
				erectionLevel = 0
			endIf
		endIf
		; DebugLog("(EquipSchlong) Actor: " + theActor + " is getting it on, keeping erection")
		; erectionLevel = 9
	endif
endif

Okay, I may be wrong, but aren't "SL.IsActorActive(theActor)" and "SL.GetActorController(theActor)", well, calls to SexLab's sytem and functions?

 

If what you say is true, that would mean this script would get borked out and stop working if you tried to run it without having SL installed and enabled. And yet, I know for a fact the quest, the script, and the whole system work fine even if you don't have SL enabled. Again, know for a fact, because I ran the game with only the race mod and its basic requirements (but NOT SL) enabled, and it worked just fine. EDIT: for the record, by "not enabled", I meant SexLab.esm was NOT loaded by the game.

 

Am I saying something stupid? Or does what I say make sense? I think I'm right, but I don't really trust myself 100%, specially against experienced scripters.

 

Sidenote: I really should ask BadDog about this as well, since he's the one that set up this script.

Link to comment

Okay..... Do a simple test - uninstall Sexlab and run mod, if you get error about SL class then your mod will work until user installs another mod that would try to hook into SL same way, then only the latest mod in loadorder will work.

 

Your scripts aren't packed in BSA so skyrim/ck will load them even if SL esm is disabled

 

And... Well my method allows me to compile mod without installing SLA, DD, PSQ and all other dependencies, only stuff I need

So.... Convert to my script religion or else!

XD

Link to comment

Okay..... Do a simple test - uninstall Sexlab and run mod, if you get error about SL class then your mod will work until user installs another mod that would try to hook into SL same way, then only the latest mod in loadorder will work.

 

Your scripts aren't packed in BSA so skyrim/ck will load them even if SL esm is disabled

 

And... Well my method allows me to compile mod without installing SLA, DD, PSQ and all other dependencies, only stuff I need

So.... Convert to my script religion or else!

XD

Okay, so, here's my log: 

 

I made sure both SL was disabled and there were no leftover scripts neither in any of my Mod Organizer folders nor in the Data folder itself, and then loaded the game. With two different copies of that quest, one from Yiffy Age and one from my race mod (and by extension, two different mods trying to run that script and hook into SL that way, unless I got that part wrong).

 

The schlong-swapping worked flawlessly for both systems, and I can only see two things in the log about it: first is the error about GetFormFromFile (which happens alongside similar errors from other mods like USLEEP or Alternate Start, and is harmless):

[09/08/2017 - 10:56:53PM] Error: File "SexLab.esm" does not exist or is not currently loaded.
stack:
	<unknown self>.Game.GetFormFromFile() - "<native>" Line ?
	[aaaBDSOSSchlongQuest (0C0D1209)].bdsosschlongquest.DoGameLoad() - "BDSOSSchlongQuest.psc" Line ?
	[aaaBDSOSSchlongQuest (0C0D1209)].bdsosschlongquest.OnInit() - "BDSOSSchlongQuest.psc" Line ?

The other thing, is a mention of missing class at the beginning, but I'm not sure if it's what you meant:

[09/08/2017 - 10:56:48PM] Cannot open store for class "sslthreadcontroller", missing file?
[09/08/2017 - 10:56:48PM] Cannot open store for class "sexlabframework", missing file?
[09/08/2017 - 10:56:48PM] Cannot open store for class "PF_IvarsteadSSKlimmekPackage_000DD5FD", missing file?

But as I said, both mods continued working fine. So I take it my idea would still be feasible, maybe? I don't know.

 

Unless someone else comes along and states whether it's possible to do it the way I wanted or not, I guess the only way to be sure is to build the script itself (maybe adding the function to the main dialogue quest and call that funtion from a dialogue fragment?) and then try runing the mod without SL or its scripts.

 

If the quest still loads and progresses as intended, then it's feasible and I can go for it; if it gets borked (or borks the schlong system), then it can't be done and I'll give up.

Link to comment

...

 

[09/08/2017 - 10:56:53PM] Error: File "SexLab.esm" does not exist or is not currently loaded.
stack:
	<unknown self>.Game.GetFormFromFile() - "<native>" Line ?
	[aaaBDSOSSchlongQuest (0C0D1209)].bdsosschlongquest.DoGameLoad() - "BDSOSSchlongQuest.psc" Line ?
	[aaaBDSOSSchlongQuest (0C0D1209)].bdsosschlongquest.OnInit() - "BDSOSSchlongQuest.psc" Line ?
...

 

Please don't clutter up the Papyrus log with avoidable shit.

 

SexlabFramework SL 

if Game.GetModByName("Sexlab.esm") !=255  ; Doesn't throw an error if Sexlab.esm isn't present
    SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework

EndIf


...


if SL
	RegisterForModEvent("AnimationStart", "OnSexLabAnimationStart")
	RegisterForModEvent("AnimationEnd", "OnSexLabAnimationEnd")
endif

Everyone dropping those errors into Papyrus could easily remove them unless they are trying to keep their code free of all SKSE functions.
Link to comment

Please don't clutter up the Papyrus log with avoidable shit. 

SexlabFramework SL 

if Game.GetModByName("Sexlab.esm") !=255  ; Doesn't throw an error if Sexlab.esm isn't present
    SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework

EndIf
...
if SL
	RegisterForModEvent("AnimationStart", "OnSexLabAnimationStart")
	RegisterForModEvent("AnimationEnd", "OnSexLabAnimationEnd")
endif

Everyone dropping those errors into Papyrus could easily remove them unless they are trying to keep their code free of all SKSE functions.

See, this is what I was looking for. Didn't know this could be done, but it seems like it's a native SKSE function indeed. I'll make sure to let BadDog know about this to get it fixed in his scripts, though I can't do the same for the other mods in my load order that do the same (USLEEP, AS-LAL, RDO, and such).

 

In other news, I've managed to set up a script fragment for a dialogue line that trigggers a SL scene but uses GetFormFromFile to skip the need for a hard dependency. I'll try using this workaround in the script and loading the game without SL. If no errors come up and both the quest and the Hoodies systems continue working as intended, then we'll know this is the way to do it.

 

Thank you very much. Even if this ends up failing, learning about the GetModByName trick has made this whole thing worth it, lol. Kudos  :lol:.

Link to comment

Okay, so it's done.

 

Using WaxenFigure's code example, I managed to set up a script fragment for a dialogue line that will trigger a SL scene if SL is installed but won't cause any errors or bugs if it's missing (the line will simply play as any other non-scripted one). I only used the QuickStart() function for my testing, but I assume if I'm able to call that one, I'll also be able to do it more properly with specific tags and so once I've done some research on SL scripting. The GitLab will probably come in handy for that (thank you MMG for the link!).

 

For some reason I had to edit the If condition like this for it to actually work, but it did afterwards, so I'll just take it:

if (Game.GetModbyName("SexLab.esm") != 255) && (Game.GetModbyName("SexLab.esm") != -1)
	SL = Game.GetFormFromFile(0xD62, "SexLab.esm") as SexLabFramework
endif

So, yeah, it seems it's indeed possible to create a soft dependency to SL and make calls and trigger scenes when it's installed without making it a hard requirement of your plugin.

 

Also, for further reference, seems like a similar issue was discussed some time ago in this thread: Making my mod SexLab independent. CPU posted a neat way to go around setting up such optional functions, by having a quest that centralizes the SL check and then calling that quest when you want to use any of SL's functions. Info here and actual code example here. I have yet to try to set up something like that, but his post about what the correct check for GetModByName was supposed to be is what fixed the check for me, so I trust his advice  :shy:.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use