Interface IPapyrusEvents
- Namespace
- SkyrimForge.Papyrus
- Assembly
- SkyrimForge.Game.dll
Publishes events to Papyrus. IPapyrusFunctionRegistrar lets a script call a plugin, and this lets a plugin reach the scripts that registered for it.
public interface IPapyrusEvents
Remarks
A script registers by calling a native the plugin implements, and the plugin raises the event when it has something to say. A registration reaches every script on the registered object declaring that event, so the script that registers and the script that receives need not be the same one.
IModEvents beside this is the other way to reach Papyrus and a different one. It broadcasts a name to everything listening for that name, with one string, one float, and one form, and it names no particular object.
Methods
Declare(string)
Names an event this plugin raises, returning the same one for a name already declared, so a plugin declaring its events on every start reaches the registrations a save restored.
PapyrusEvent Declare(string eventName)
Parameters
eventNamestringThe name the receiving script declares, as
Event OnGoldSpent(int amount).
Returns
Remarks
The registrations of a name are shared by every plugin in the process, so a prefix separates one plugin's event names from another's. A name is compared without regard to case, as Papyrus compares it. A form cannot be passed to an event declared this way, since no script states the class of its parameter.
Exceptions
- ArgumentNullException
eventNameisnull.- ArgumentException
eventNameis empty.- InvalidOperationException
The native side made no registration set for the name.
Declare(string, string)
Names an event this plugin raises and the script that declares it, returning the same one for a pair already declared, so a plugin declaring its events on every start reaches the registrations a save restored.
PapyrusEvent Declare(string scriptName, string eventName)
Parameters
scriptNamestringThe script whose declaration states the parameter types, as
MyScript.eventNamestringThe name the receiving script declares, as
Event OnTargetChosen(Actor target).
Returns
Remarks
Each raising is checked against that script's declaration, and each form passed is bound to the class the declaration states for its parameter. The Papyrus VM runs an event only where each form is bound to the class its parameter declares, so a receiving script that declares another class for that parameter does not receive the event. The registrations belong to the event name alone and are shared by every plugin in the process, so a prefix separates one plugin's event names from another's. A name is compared without regard to case, as Papyrus compares it.
Exceptions
- ArgumentNullException
scriptNameoreventNameisnull.- ArgumentException
scriptNameoreventNameis empty.- InvalidOperationException
The native side made no registration set for the name.