Difference between revisions of "Events Reference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Henning
 
imported>Catwheezle
(Category:Events did not exist, so the end of the lede was not even shown (wiki bug?). I linked instead to the page, which at least has something.)
Line 1: Line 1:
Events are special [[Function Reference|functions]] that the game will call when something happens. Note that simply defining an event won't make the game call it, you must follow the name and argument list of an event that the game [[Category:Events|already sends you]]
Events are special [[Function Reference|functions]] that the game will call when something happens. Note that simply defining an event won't make the game call it, you must follow the name and argument list of an event that the game [[Events|already sends you]].


== Event Definition ==
== Event Definition ==

Revision as of 23:28, 14 February 2012

Events are special functions that the game will call when something happens. Note that simply defining an event won't make the game call it, you must follow the name and argument list of an event that the game already sends you.

Event Definition

<event> ::= <event header>
            [<function block>
            'endEvent']

Function headers must always be followed by a standard function block and "EndEvent", unless they are native (which are handled by the game).

Event Header

<event header> ::= 'Event' <identifier> '(' [<parameters>] ')' ['Native'] <flags>*

The event header is identical to the function header, but does not allow for return types or allow for the "Global" flag.

Parameters

The parameters are identical to the function parameter list, but should match the data that the game will send to the event.

Examples

; A simple activate event handler 
Event OnActivate(ObjectReference akActivator)
  PlayAnimation("CoolStuff")
endEvent

Special Variables

Event special variables are identical to a non-global function's.

Calling Events

Calling events is identical to calling a function.