Jump to content

Script Question


Tyrant99

Recommended Posts

Posted

 

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?

Archived

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

  • Recently Browsing   0 members

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