Difference between revisions of "Events Reference"

From the CreationKit Wiki
Jump to navigation Jump to search
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.)
imported>Catwheezle
(Added "see also" section.)
Line 29: Line 29:
== Calling Events ==
== Calling Events ==
Calling events is identical to calling a [[Function Reference#Calling Functions|function]].
Calling events is identical to calling a [[Function Reference#Calling Functions|function]].
== See Also ==
[[Events]]


[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Papyrus]]
[[Category:Papyrus Language Reference]]
[[Category:Papyrus Language Reference]]

Revision as of 22:29, 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.

See Also

Events