Difference between revisions of "RegisterForExternalEvent - ScriptObject"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Qazaaq
(added f4se member)
 
imported>Qazaaq
(added example)
 
(3 intermediate revisions by one other user not shown)
Line 3: Line 3:
{{Template:Papyrus:RequiredF4SE|version=0.3.1}}
{{Template:Papyrus:RequiredF4SE|version=0.3.1}}


Placeholder Description.
Callback is the function name that is called when the event is triggered.


== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
Function RegisterForExternalEvent(string asEventName, string asCallback) Native
Function RegisterForExternalEvent(string eventName, string callback) Native
</source>
</source>


== Parameters ==
== Parameters ==
*asEventName: Placeholder Description.
*eventName: The name of the event that you want to register for.
*asCallback: Placeholder Description.
*callback: The function name that is called when the event is triggered.


== Return Value ==
== Return Value ==
Line 19: Line 19:
== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">
; Placeholder Code.
Scriptname ChildType extends BaseType
 
; The name of an external event.
string MyModResetEvent = "MyModResetEvent" const
 
Event OnQuestInit()
RegisterForExternalEvent(MyModResetEvent, "OnMyModReset")
EndEvent
 
Event OnMyModReset()
Debug.TraceSelf(self, "OnMyModReset", "We have the external event handled.")
EndEvent
 
</source>
 
<source lang="papyrus">
ScriptName BaseType extends Quest Native Const Hidden
 
Event OnMyModReset() Native
{New event declaration. Overrride in extending scripts.}
 
</source>
</source>


== See Also ==
== See Also ==

Latest revision as of 03:06, 25 June 2019

This article has been flagged as incomplete.
Please help improve the wiki by learning how to contribute.

F4SE Member of: ScriptObject Script
Requires F4SE version 0.3.1 or higher.

Callback is the function name that is called when the event is triggered.

Syntax[edit | edit source]

Function RegisterForExternalEvent(string eventName, string callback) Native

Parameters[edit | edit source]

  • eventName: The name of the event that you want to register for.
  • callback: The function name that is called when the event is triggered.

Return Value[edit | edit source]

  • None

Examples[edit | edit source]

Scriptname ChildType extends BaseType

; The name of an external event.
string MyModResetEvent = "MyModResetEvent" const

Event OnQuestInit()
	RegisterForExternalEvent(MyModResetEvent, "OnMyModReset")
EndEvent

Event OnMyModReset()
	Debug.TraceSelf(self, "OnMyModReset", "We have the external event handled.")
EndEvent
ScriptName BaseType extends Quest Native Const Hidden

Event OnMyModReset() Native
{New event declaration. Overrride in extending scripts.}


See Also[edit | edit source]