Jump to content

[Script] How to set up a "yes/no" script? (Beginner, sorry)


Recommended Posts

Ok, think I got it...
hmm, think I figured it out.... Seems I was close right at the beginning, just missed a "==" instead of a "=" lol :D details....
(see below for the updated script). the question from my second post still stands tho. 

Can I somehow check if a mod event is active? Especially DHLP suspend?

 

Ok, I suspect this is dead easy for anybody who had a half decent basic education on the matter, but for me this seems impossible ^^
So I crawl here for help...

 

What I want:

- I want this Function to Check if "DHLP-suspend" is active or not.
If it is active, it should do nothing. 

If it is not active it should activate "DHLP-suspend" mod event

Please ignore the script technique, its not my script I m just altering it to improve it. 
To explain: This is a script that "links" different events in a mod (sex scenes, furniture capture etc) and I want to protect them from other mods interfering with them starting Sex Scenes in that period (killing everything in the process :))

Thank you already for giving me primary school lessons :D

DHLP = false 							;(this is the base condition before anything happens)

Function Immobilize(Bool value = true)			
	if libs.PlayerRef.IsSneaking()
		libs.PlayerRef.StartSneaking()
	endif
	if value
		libs.PlayerRef.StopCombat()
		libs.PlayerRef.StopCombatAlarm()						
	if 	DHLP = false				;(this should activate when the base condition is met)
		SendModEvent("dhlp-Suspend")								
		DHLP = true					;(this should change the base condition to prevent DHLP from stacking on top of each other)
	endif	
		libs.PlayerRef.PlayIdle(Poses[1])
		Game.SetPlayerAIDriven(true)
		Game.DisablePlayerControls(1, 1, 0, 0, 1, 1, 1, 1, 1)	
	else
		SendModEvent("dhlp-Resume")								
		DHLP = false				;(this should revert the DHLP condition back to the base state because it is no longer needed)
		Game.EnablePlayerControls()
		Game.SetPlayerAIDriven(false)
		libs.PlayerRef.PlayIdle(Poses[0])
	endif
EndFunction

 

 

EDIT:

hmm, think I figured it out.... Seems I was close right at the beginning, just missed a "==" instead of a "=" lol :D details....
 

bool DHLP = false

Function Immobilize(Bool value = true)			;NYMRA: this immobilizes the PC. Happens multiple times in different situations! searchword: qqq
	if libs.PlayerRef.IsSneaking()
		libs.PlayerRef.StartSneaking()
	endif
	if value
		if DHLP == false
		SendModEvent("dhlp-Suspend")
		Debug.Notification("NDUN dhlp ON")		;NYMRA -> avoid Sexlab starts
		DHLP = true
		endif
		libs.PlayerRef.StopCombat()
		libs.PlayerRef.StopCombatAlarm()						
		libs.PlayerRef.PlayIdle(Poses[1])
		Game.SetPlayerAIDriven(true)
		;Game.DisablePlayerControls(1, 1, 0, 0, 1, 0, 1, 0, 0)	;SAVE ORIG
		Game.DisablePlayerControls(1, 1, 0, 0, 1, 1, 1, 1, 1)	;NYMRA - avoids breaking out of furniture
	else
		SendModEvent("dhlp-resume")	
		Debug.Notification("NDUN dhlp OFF")		;NYMRA -> avoid Sexlab starts
		DHLP = false
		Game.EnablePlayerControls()
		Game.SetPlayerAIDriven(false)
		libs.PlayerRef.PlayIdle(Poses[0])
	endif
EndFunction

 

Link to comment

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...

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