Skip to content

Fallback Event API Reference

Chesko edited this page Jul 31, 2016 · 4 revisions

FallbackEventEmitter Functions


int GetVersion()

Since API Version: 1

Description: Returns the version of the API.

Return value: The version of the Fallback Event API.


int Create(string asEventName)

Since API Version: 1

Description: Creates a new SKSE (if SKSE is installed) or Fallback event handle.

Return value: The event handler, to be used for pushing data to the event handle or sending it.


bool Send(int handle)

Since API Version: 1

Description: Sends a created event handle.

Return value: True if the SKSE or Fallback event was successfully sent, false otherwise.

Example:

scriptname someOtherScript extends ObjectReference

Quest property MyEventEmitter auto

function bar()
  ; Send myCoolEvent using SKSE ModEvent OR Fallback Event, depending on
  ; if the user has SKSE or not.

  FallbackEventEmitter emitter = MyEventEmitter as FallbackEventEmitter
  int handle = emitter.Create("myCoolEvent")
  if handle
    emitter.PushBool(handle, true)
    emitter.PushString(handle, "eat at joe's")
    emitter.PushInt(handle, 42)
    emitter.PushInt(handle, 17)
    emitter.Send(handle)
  endif
endFunction

Release(int handle)

Since API Version: 1

Description: Releases the created SKSE / Fallback event handle without sending it.

Return value: None.


RegisterFormForModEventWithFallback(string asEventName, string asCallbackName, Form akReceiver)

Since API Version: 1

Description: Registers a form for an SKSE Mod Event or Fallback Event (if SKSE is not installed).

Parameters:

  • asEventName: The internal event name. See SKSE Mod Event documentation for details.
  • asCallbackName: The name of the event to call when this event is raised. See SKSE Mod Event documentation for details.
  • akReceiver: The Form that will receive this event.

Return value: None.

Example:

scriptname myWagonScript extends ObjectReference

Quest property MyEventEmitter auto

function foo()
  ; Register for the custom event.
  FallbackEventEmitter emitter = MyEventEmitter as FallbackEventEmitter
  emitter.RegisterFormForModEventWithFallback("myCoolEvent", "myCoolEventCallback", self as Form)
endFunction

Event myCoolEventCallback(bool someBool, string someString, int someInt, int anotherInt)
  ; do something cool here!
endEvent

RegisterAliasForModEventWithFallback(string asEventName, string asCallbackName, Alias akReceiver)

Since API Version: 1

Description: Registers an alias for an SKSE Mod Event or Fallback Event (if SKSE is not installed).

Parameters:

  • asEventName: The internal event name. See SKSE Mod Event documentation for details.
  • asCallbackName: The name of the event to call when this event is raised. See SKSE Mod Event documentation for details.
  • akReceiver: The Alias that will receive this event.

Return value: None.

Example:

scriptname myPlayerAlias extends ReferenceAlias

Quest property MyEventEmitter auto

function foo()
  ; Register for the custom event.
  FallbackEventEmitter emitter = MyEventEmitter as FallbackEventEmitter
  emitter.RegisterAliasForModEventWithFallback("myCoolEvent", "myCoolEventCallback", self as Alias)
endFunction

Event myCoolEventCallback(bool someBool, string someString, int someInt, int anotherInt)
  ; do something cool here!
endEvent

RegisterActiveMagicEffectForModEventWithFallback(string asEventName, string asCallbackname, ActiveMagicEffect akReceiver)

Since API Version: 1

Description: Registers an active magic effect for an SKSE Mod Event or Fallback Event (if SKSE is not installed).

Parameters:

  • asEventName: The internal event name. See SKSE Mod Event documentation for details.
  • asCallbackName: The name of the event to call when this event is raised. See SKSE Mod Event documentation for details.
  • akReceiver: The ActiveMagicEffect that will receive this event.

Return value: None.

Example:

scriptname someCoolEffect extends ActiveMagicEffect

Quest property MyEventEmitter auto

function foo()
  ; Register for the custom event.
  FallbackEventEmitter emitter = MyEventEmitter as FallbackEventEmitter
  emitter.RegisterActiveMagicEffectForModEventWithFallback("myCoolEvent", "myCoolEventCallback", self as ActiveMagicEffect)
endFunction

Event myCoolEventCallback(bool someBool, string someString, int someInt, int anotherInt)
  ; do something cool here!
endEvent

UnregisterFormForModEventWithFallback(string asEventName, Form akReceiver)

Since API Version: 1

Description: Unregisters a form from an SKSE Mod Event or Fallback Event (if SKSE is not installed).

Parameters:

  • asEventName: The internal event name. See SKSE Mod Event documentation for details.
  • akReceiver: The Form registered to this event.

Return value: None.


UnregisterAliasForModEventWithFallback(string asEventName, Alias akReceiver)

Since API Version: 1

Description: Unregisters an alias from an SKSE Mod Event or Fallback Event (if SKSE is not installed).

Parameters:

  • asEventName: The internal event name. See SKSE Mod Event documentation for details.
  • akReceiver: The Alias registered to this event.

Return value: None.


UnregisterActiveMagicEffectForModEventWithFallback(string asEventName, ActiveMagicEffect akReceiver)

Since API Version: 1

Description: Unregisters an active magic effect from an SKSE Mod Event or Fallback Event (if SKSE is not installed).

Parameters:

  • asEventName: The internal event name. See SKSE Mod Event documentation for details.
  • akReceiver: The ActiveMagicEffect registered to this event.

Return value: None.


PushBool(int handle, bool value)

Since API Version: 1

Description: Push a bool to the given event handle. See SKSE Mod Event documentation for more info.

Parameters:

  • handle: The event handle to push data to.
  • value: The data to push.

Return value: None.


PushInt(int handle, int value)

Since API Version: 1

Description: Push an int to the given event handle. See SKSE Mod Event documentation for more info.

Parameters:

  • handle: The event handle to push data to.
  • value: The data to push.

Return value: None.


PushFloat(int handle, float value)

Since API Version: 1

Description: Push a float to the given event handle. See SKSE Mod Event documentation for more info.

Parameters:

  • handle: The event handle to push data to.
  • value: The data to push.

Return value: None.


PushString(int handle, string value)

Since API Version: 1

Description: Push a string to the given event handle. See SKSE Mod Event documentation for more info.

Parameters:

  • handle: The event handle to push data to.
  • value: The data to push.

Return value: None.


PushForm(int handle, form value)

Since API Version: 1

Description: Push a form to the given event handle. See SKSE Mod Event documentation for more info.

Parameters:

  • handle: The event handle to push data to.
  • value: The data to push.

Return value: None.

FallbackEventReceiverForm functions


RaiseEvent(String asEventName, Bool[] pushedBools, Int[] pushedInts, Float[] pushedFloats, Form[] pushedForms, String[] pushedStrings)

Since API Version: 1

Description: Does nothing on its own. Extend this script and override this function to call your custom event. The event data is stored in the parameters in the order they were pushed.

Return value: None.

Example:

scriptname myWagonEventReceiver extends FallbackEventReceiverForm

function RaiseEvent(String asEventName, Bool[] pushedBools, Int[] pushedInts, Float[] pushedFloats, Form[] pushedForms, String[] pushedStrings)
  if asEventName == "myCoolEvent"
    bool firstParam = pushedBools[0]
    string secondParam = pushedStrings[0]
    int thirdParam = pushedInts[0]
    int fourthParam = pushedInts[1]
    (self as myWagonScript).myCoolEventCallback(firstParam, secondParam, thirdParam, fourthParam)
  endif
endFunction

FallbackEventReceiverAlias functions


RaiseEvent(String asEventName, Bool[] pushedBools, Int[] pushedInts, Float[] pushedFloats, Form[] pushedForms, String[] pushedStrings)

Since API Version: 1

Description: Does nothing on its own. Extend this script and override this function to call your custom event. The event data is stored in the parameters in the order they were pushed.

Return value: None.

FallbackEventReceiverActiveMagicEffect functions


RaiseEvent(String asEventName, Bool[] pushedBools, Int[] pushedInts, Float[] pushedFloats, Form[] pushedForms, String[] pushedStrings)

Since API Version: 1

Description: Does nothing on its own. Extend this script and override this function to call your custom event. The event data is stored in the parameters in the order they were pushed.

Return value: None.

Clone this wiki locally