Jump to content
Tyrant99

Script Question

Recommended Posts

 

Question on SendModEvent()

 

In most cases, I see SendModEvent used in scripts without an evaluation of whether the corresponding Mod is installed. I assume that it just returns null if the Mod is absent. But, is this the best practice, or would it be better to do a bool for whether the Mod is installed and then use the SendModEvent with bool logic?

 

I.E. instead of simply calling:

 

SendModEvent("dhlp-Resume")

 

Would it be better to do:

 

bool property installed_DeviouslyHelpless = False Auto

Function CheckInstalled(); gets called on initialization in MCM or some such.
	if Game.GetModByName("DeviouslyHelpless.esp") == 255
		installed_DeviouslyHelpless = false
	else
		installed_DeviouslyHelpless = true
	endif
EndFunction

Function SomeFunction()
If installed_DeviouslyHelpless == True
	SendModEvent("dhlp-Resume")
EndIf
EndFunction

 

More long winded but presumably would return fewer errors?

 

Or, does it not matter and short hand SendModEvent with no bool logic is fine?

Link to post

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