Module Event

This module contains the EVENT class, which models the dispatching of DCS Events to subscribed MOOSE classes, following a given priority.

Banner Image


  • This module contains the EVENT class.

Takes care of EVENT dispatching between DCS events and event handling functions defined in MOOSE classes.


The above menus classes are derived from 2 main abstract classes defined within the MOOSE framework (so don't use these):


Contributions: -

Authors: FlightControl : Design & Programming

Global(s)

EVENT
EVENTS

Type EVENT

EVENT.ClassID
EVENT.ClassName
EVENT:EventText(EventID)
EVENT.Events
EVENT:Init(EventID, EventClass)

Initializes the Events structure for the event

EVENT:New()
EVENT:OnBirth(EventFunction, EventClass)

Set a new listener for an SEVENTBIRTH event, and registers the unit born.

EVENT:OnBirthForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)

Create an OnBirth event handler for a group

EVENT:OnBirthForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTBIRTH event.

EVENT:OnBirthRemove(EventClass)

Stop listening to SEVENTBIRTH event.

EVENT:OnCrash(EventFunction, EventClass)

Set a new listener for an SEVENTCRASH event.

EVENT:OnCrashForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)

Create an OnCrash event handler for a group

EVENT:OnCrashForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTCRASH event.

EVENT:OnCrashRemove(EventClass)

Stop listening to SEVENTCRASH event.

EVENT:OnDead(EventFunction, EventClass)

Set a new listener for an SEVENTDEAD event.

EVENT:OnDeadForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)

Create an OnDead event handler for a group

EVENT:OnDeadForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTDEAD event.

EVENT:OnDeadRemove(EventClass)

Stop listening to SEVENTDEAD event.

EVENT:OnEngineShutDownForTemplate(EventTemplate, EventFunction, EventClass)

Create an OnDead event handler for a group

EVENT:OnEngineShutDownForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTENGINE_SHUTDOWN event.

EVENT:OnEngineShutDownRemove(EventClass)

Stop listening to SEVENTENGINE_SHUTDOWN event.

EVENT:OnEngineStartUpForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTENGINE_STARTUP event.

EVENT:OnEngineStartUpRemove(EventClass)

Stop listening to SEVENTENGINE_STARTUP event.

EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventClass, OnEventFunction)

Create an OnDead event handler for a group

EVENT:OnEventForUnit(EventDCSUnitName, EventFunction, EventClass, EventID)

Set a new listener for an SEVENTX event

EVENT:OnEventGeneric(EventFunction, EventClass, EventID)

Set a new listener for an SEVENTX event independent from a unit or a weapon.

EVENT:OnHit(EventFunction, EventClass)

Set a new listener for an SEVENTHIT event.

EVENT:OnHitForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTHIT event.

EVENT:OnHitRemove(EventClass)

Stop listening to SEVENTHIT event.

EVENT:OnLandForTemplate(EventTemplate, EventFunction, EventClass)
EVENT:OnLandForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTLAND event.

EVENT:OnLandRemove(EventClass)

Stop listening to SEVENTLAND event.

EVENT:OnPilotDead(EventFunction, EventClass)

Set a new listener for an SEVENTPILOT_DEAD event.

EVENT:OnPilotDeadForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTPILOT_DEAD event.

EVENT:OnPilotDeadRemove(EventClass)

Stop listening to SEVENTPILOT_DEAD event.

EVENT:OnPlayerEnterRemove(EventClass)

Stop listening to SEVENTPLAYERENTERUNIT event.

EVENT:OnPlayerEnterUnit(EventFunction, EventClass)

Set a new listener for an SEVENTPLAYERENTERUNIT event.

EVENT:OnPlayerLeaveRemove(EventClass)

Stop listening to SEVENTPLAYERLEAVEUNIT event.

EVENT:OnPlayerLeaveUnit(EventFunction, EventClass)
EVENT:OnShot(EventFunction, EventClass)
EVENT:OnShotForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTSHOT event for a unit.

EVENT:OnShotRemove(EventClass)

Stop listening to SEVENTSHOT event.

EVENT:OnTakeOffForTemplate(EventTemplate, EventFunction, EventClass)
EVENT:OnTakeOffForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTTAKEOFF event.

EVENT:OnTakeOffRemove(EventClass)

Stop listening to SEVENTTAKEOFF event.

EVENT:Remove(EventClass, EventID)

Removes an Events entry

EVENT:RemoveAll(EventObject)

Clears all event subscriptions for a Base#BASE derived object.

EVENT:RemoveForUnit(EventClass, EventID, UnitName)

Removes an Events entry for a Unit

EVENT:onEvent(Event)

Type EVENT.Events

EVENT.Events.IniUnit

Type EVENTDATA

EVENTDATA.IniDCSGroup
EVENTDATA.IniDCSGroupName
EVENTDATA.IniDCSUnit
EVENTDATA.IniDCSUnitName
EVENTDATA.IniGroup
EVENTDATA.IniUnit
EVENTDATA.IniUnitName
EVENTDATA.TgtDCSGroup
EVENTDATA.TgtDCSGroupName
EVENTDATA.TgtDCSUnit
EVENTDATA.TgtDCSUnitName
EVENTDATA.TgtUnit
EVENTDATA.TgtUnitName
EVENTDATA.Weapon
EVENTDATA.WeaponName
EVENTDATA.WeaponTgtDCSUnit
EVENTDATA.id
EVENTDATA.initiator
EVENTDATA.target
EVENTDATA.weapon

Global(s)

#EVENT EVENT
EVENTS

Type Event

Type EVENT

The EVENT structure

Field(s)

#number EVENT.ClassID
#string EVENT.ClassName
EVENT:EventText(EventID)

Parameter

  • EventID :

#EVENT.Events EVENT.Events
EVENT:Init(EventID, EventClass)

Initializes the Events structure for the event

Parameters

Return value

#EVENT.Events:

EVENT:New()
EVENT:OnBirth(EventFunction, EventClass)

Set a new listener for an SEVENTBIRTH event, and registers the unit born.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass :

Return value

#EVENT:

EVENT:OnBirthForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)

Create an OnBirth event handler for a group

Parameters

  • Wrapper.Group#GROUP EventGroup :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • EventClass : The self instance of the class for which the event is.

  • EventTemplate :

Return value

#EVENT:

EVENT:OnBirthForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTBIRTH event.

Parameters

  • #string EventDCSUnitName : The id of the unit for the event to be handled.

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass :

Return value

#EVENT:

EVENT:OnBirthRemove(EventClass)

Stop listening to SEVENTBIRTH event.

Parameter

Return value

#EVENT:

EVENT:OnCrash(EventFunction, EventClass)

Set a new listener for an SEVENTCRASH event.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass :

Return value

#EVENT:

EVENT:OnCrashForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)

Create an OnCrash event handler for a group

Parameters

  • Wrapper.Group#GROUP EventGroup :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • EventClass : The self instance of the class for which the event is.

  • EventTemplate :

Return value

#EVENT:

EVENT:OnCrashForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTCRASH event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnCrashRemove(EventClass)

Stop listening to SEVENTCRASH event.

Parameter

Return value

#EVENT:

EVENT:OnDead(EventFunction, EventClass)

Set a new listener for an SEVENTDEAD event.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass :

Return value

#EVENT:

EVENT:OnDeadForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)

Create an OnDead event handler for a group

Parameters

  • Wrapper.Group#GROUP EventGroup :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • EventClass : The self instance of the class for which the event is.

  • EventTemplate :

Return value

#EVENT:

EVENT:OnDeadForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTDEAD event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnDeadRemove(EventClass)

Stop listening to SEVENTDEAD event.

Parameter

Return value

#EVENT:

EVENT:OnEngineShutDownForTemplate(EventTemplate, EventFunction, EventClass)

Create an OnDead event handler for a group

Parameters

  • #table EventTemplate :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnEngineShutDownForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTENGINE_SHUTDOWN event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnEngineShutDownRemove(EventClass)

Stop listening to SEVENTENGINE_SHUTDOWN event.

Parameter

Return value

#EVENT:

EVENT:OnEngineStartUpForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTENGINE_STARTUP event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnEngineStartUpRemove(EventClass)

Stop listening to SEVENTENGINE_STARTUP event.

Parameter

Return value

#EVENT:

EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventClass, OnEventFunction)

Create an OnDead event handler for a group

Parameters

  • #table EventTemplate :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • EventClass : The instance of the class for which the event is.

  • #function OnEventFunction :

Return value

#EVENT:

EVENT:OnEventForUnit(EventDCSUnitName, EventFunction, EventClass, EventID)

Set a new listener for an SEVENTX event

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Core.Base#BASE EventClass : The self instance of the class for which the event is.

  • EventID :

Return value

#EVENT:

EVENT:OnEventGeneric(EventFunction, EventClass, EventID)

Set a new listener for an SEVENTX event independent from a unit or a weapon.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Core.Base#BASE EventClass : The self instance of the class for which the event is captured. When the event happens, the event process will be called in this class provided.

  • EventID :

Return value

#EVENT:

EVENT:OnHit(EventFunction, EventClass)

Set a new listener for an SEVENTHIT event.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnHitForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTHIT event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnHitRemove(EventClass)

Stop listening to SEVENTHIT event.

Parameter

Return value

#EVENT:

EVENT:OnLandForTemplate(EventTemplate, EventFunction, EventClass)

Parameters

  • EventTemplate :

  • EventFunction :

  • EventClass :

EVENT:OnLandForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTLAND event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnLandRemove(EventClass)

Stop listening to SEVENTLAND event.

Parameter

Return value

#EVENT:

EVENT:OnPilotDead(EventFunction, EventClass)

Set a new listener for an SEVENTPILOT_DEAD event.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass :

Return value

#EVENT:

EVENT:OnPilotDeadForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTPILOT_DEAD event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnPilotDeadRemove(EventClass)

Stop listening to SEVENTPILOT_DEAD event.

Parameter

Return value

#EVENT:

EVENT:OnPlayerEnterRemove(EventClass)

Stop listening to SEVENTPLAYERENTERUNIT event.

Parameter

Return value

#EVENT:

EVENT:OnPlayerEnterUnit(EventFunction, EventClass)

Set a new listener for an SEVENTPLAYERENTERUNIT event.

Parameters

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnPlayerLeaveRemove(EventClass)

Stop listening to SEVENTPLAYERLEAVEUNIT event.

Parameter

Return value

#EVENT:

EVENT:OnPlayerLeaveUnit(EventFunction, EventClass)

Parameters

  • EventFunction :

  • EventClass :

EVENT:OnShot(EventFunction, EventClass)

Parameters

  • EventFunction :

  • EventClass :

EVENT:OnShotForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTSHOT event for a unit.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnShotRemove(EventClass)

Stop listening to SEVENTSHOT event.

Parameter

Return value

#EVENT:

EVENT:OnTakeOffForTemplate(EventTemplate, EventFunction, EventClass)

Parameters

  • EventTemplate :

  • EventFunction :

  • EventClass :

EVENT:OnTakeOffForUnit(EventDCSUnitName, EventFunction, EventClass)

Set a new listener for an SEVENTTAKEOFF event.

Parameters

  • #string EventDCSUnitName :

  • #function EventFunction : The function to be called when the event occurs for the unit.

  • Base#BASE EventClass : The self instance of the class for which the event is.

Return value

#EVENT:

EVENT:OnTakeOffRemove(EventClass)

Stop listening to SEVENTTAKEOFF event.

Parameter

Return value

#EVENT:

EVENT:Remove(EventClass, EventID)

Removes an Events entry

Parameters

Return value

#EVENT.Events:

EVENT:RemoveAll(EventObject)

Clears all event subscriptions for a Base#BASE derived object.

Parameter

EVENT:RemoveForUnit(EventClass, EventID, UnitName)

Removes an Events entry for a Unit

Parameters

Return value

#EVENT.Events:

EVENT:onEvent(Event)

Parameter

Type EVENT.Events

The Events structure

Field(s)

#number EVENT.Events.IniUnit

Type EVENTDATA

The Event structure

Field(s)

EVENTDATA.IniDCSGroup
EVENTDATA.IniDCSGroupName
EVENTDATA.IniDCSUnit
EVENTDATA.IniDCSUnitName
EVENTDATA.IniGroup
Wrapper.Unit#UNIT EVENTDATA.IniUnit
#string EVENTDATA.IniUnitName
EVENTDATA.TgtDCSGroup
EVENTDATA.TgtDCSGroupName
EVENTDATA.TgtDCSUnit
EVENTDATA.TgtDCSUnitName
Wrapper.Unit#UNIT EVENTDATA.TgtUnit
#string EVENTDATA.TgtUnitName
EVENTDATA.Weapon
EVENTDATA.WeaponName
EVENTDATA.WeaponTgtDCSUnit
EVENTDATA.id
EVENTDATA.initiator
EVENTDATA.target
EVENTDATA.weapon