Difference between revisions of "RegisterForModEvent - Form"
Jump to navigation
Jump to search
Edited to be a bit more like the vanilla reference pages
imported>Jbezorg (Created page with "Registers a custom event callback for given event name. Registrations have to be refreshed after each game load. Examples: RegisterForModEvent("myCustomEvent", "MyModEventC...") |
imported>Templar-von-Midgard (Edited to be a bit more like the vanilla reference pages) |
||
Line 1: | Line 1: | ||
[[Category:Scripting]] | |||
[[Category:Papyrus]] | |||
'''SKSE Member of:''' [[ActiveMagicEffect Script]], [[Alias Script]], and [[Form Script]] | |||
Registers a custom event callback for given event name. | Registers a custom event callback for given event name. | ||
Registrations have to be refreshed after each game load. | Registrations have to be refreshed after each game load. | ||
Examples: | == Syntax == | ||
<source lang="papyrus"> | |||
Function RegisterForModEvent(string eventName, string callbackName) native | |||
;The event: | |||
Event callbackName(string eventName, string strArg, float numArg, Form sender) | |||
EndEvent | |||
</source> | |||
== Parameters == | |||
*eventName: The name of the event sent by SendModEvent. | |||
*callbackName: The name by which you can catch the event. | |||
== Examples == | |||
<source lang="papyrus"> | |||
; Register to receive the ModEvent: | |||
; named HectorHitMe with the callback of OnHectorHitMe | |||
RegisterForModEvent("HectorHitMe", "OnHectorHitMe") | |||
Event OnHectorHitMe(string eventName, string strArg, float numArg, Form sender) | |||
;Do something | |||
EndEvent | |||
</source> | |||
== Notes == | |||
*Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed. | |||
*You must register for ModEvents after every game load! | |||
== See Also == | |||
*[[ActiveMagicEffect Script]] | |||
*[[Alias Script]] | |||
*[[Form Script]] |