Difference between revisions of "Events Reference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Henning
(No difference)

Revision as of 14:05, 23 November 2011

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

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.