Difference between revisions of "Event Handling"
imported>Odessa (+note its in nvse 4.6) |
imported>JT (redlink [Events] -> [Event]s (per nonplural convention for page titles)) |
||
Line 5: | Line 5: | ||
An event handler allows response to game events, without having to attach scripts directly to objects. Instead, the scripter uses [[SetEventHandler]] to register a [[User Defined Function]] as a handler for a specific event. When an event occurs during gameplay, NVSE will invoke any handlers that correspond to it, passing information about the event to their function through its arguments. | An event handler allows response to game events, without having to attach scripts directly to objects. Instead, the scripter uses [[SetEventHandler]] to register a [[User Defined Function]] as a handler for a specific event. When an event occurs during gameplay, NVSE will invoke any handlers that correspond to it, passing information about the event to their function through its arguments. | ||
Each event expects its handlers to accept a specific set of arguments. The in built events, including any required arguments (listed in the order in which they should appear in the function definition) are listed in the table below. In addition, [[User Defined | Each event expects its handlers to accept a specific set of arguments. The in built events, including any required arguments (listed in the order in which they should appear in the function definition) are listed in the table below. In addition, [[User Defined Event]]s are possible. | ||
{| class="wikitable" style="width:100%; text-align:left" align="center" | {| class="wikitable" style="width:100%; text-align:left" align="center" |
Revision as of 18:12, 8 August 2015
Event handling is added by NVSE 4.6, and was ported from OBSE.
Events include block types found in object scripts, such as "OnHit", "OnDeath", and so on, as well as other events involving loading, saving, and exiting the game.
An event handler allows response to game events, without having to attach scripts directly to objects. Instead, the scripter uses SetEventHandler to register a User Defined Function as a handler for a specific event. When an event occurs during gameplay, NVSE will invoke any handlers that correspond to it, passing information about the event to their function through its arguments.
Each event expects its handlers to accept a specific set of arguments. The in built events, including any required arguments (listed in the order in which they should appear in the function definition) are listed in the table below. In addition, User Defined Events are possible.
Event | First | Second | |
---|---|---|---|
OnActivate | Activator/Activated | ActionRef | |
OnActorEquip | Equipper | Equipped | |
OnActorUnequip | Unequipped | Unequipped | |
OnAdd | AddedTo | AddedItem | |
OnClose | Closed | Closer | |
OnCombatEnd | Target | Ender | |
OnDeath | Killed | Killer | |
OnDrop | Dropper | Dropped | |
OnHit | Target | Attacker | |
OnHitWith | Target | Weapon | |
OnLoad | Loaded | ||
OnMagicEffectHit | Target | BaseEffect | |
OnMurder | Murdered | Murderer | |
OnOpen | Opened | Opener | |
OnPackageStart | Actor | Package | |
OnPackageChange | Actor | Package | |
OnPackageDone | Actor | Package | |
OnReset | WhatsReset | ||
OnSell | SoldInvItem | Seller (Player only?) | |
OnStartCombat | Target | Starter | |
OnTrigger | Trigger | ActionRef | |
OnTriggerEnter | Trigger | ActionRef | |
OnTriggerLeave | Trigger | ActionRef | |
SayToDone | Speaker | Info | |
- - - | |||
Corresponding to Plugin API | |||
ExitGame | |||
ExitToMainMenu | |||
LoadGame | |||
SaveGame | |||
QQQ | |||
PostLoadGame | |||
RuntimeScriptError | |||
DeleteGame | |||
RenameGame | |||
RenameNewGame | |||
NewGame | |||
DeleteGameName | |||
RenameGameName | |||
RenameNewGameName |
Event Functions
External Links
This article is a stub, you can help the community by expanding it.