Banner Image

Module Core.Fsm

Core - FSM (Finite State Machine) are objects that model and control long lasting business processes and workflow.


Features:

  • Provide a base class to model your own state machines.
  • Trigger events synchronously.
  • Trigger events asynchronously.
  • Handle events before or after the event was triggered.
  • Handle state transitions as a result of event before and after the state change.
  • For internal moose purposes, further state machines have been designed:
    • to handle controllables (groups and units).
    • to handle tasks.
    • to handle processes.

A Finite State Machine (FSM) models a process flow that transitions between various States through triggered Events.

A FSM can only be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by an internal or external triggering event, which is called a transition. A FSM implementation is defined by a list of its states, its initial state, and the triggering events for each possible transition. A FSM implementation is composed out of two parts, a set of state transition rules, and an implementation set of state transition handlers, implementing those transitions.

The FSM class supports a hierarchical implementation of a Finite State Machine, that is, it allows to embed existing FSM implementations in a master FSM. FSM hierarchies allow for efficient FSM re-use, not having to re-invent the wheel every time again when designing complex processes.

Workflow Example

The above diagram shows a graphical representation of a FSM implementation for a Task, which guides a Human towards a Zone, orders him to destroy x targets and account the results. Other examples of ready made FSM could be:

  • Route a plane to a zone flown by a human.
  • Detect targets by an AI and report to humans.
  • Account for destroyed targets by human players.
  • Handle AI infantry to deploy from or embark to a helicopter or airplane or vehicle.
  • Let an AI patrol a zone.

The MOOSE framework extensively uses the FSM class and derived FSM_ classes, because the goal of MOOSE is to simplify mission design complexity for mission building. By efficiently utilizing the FSM class and derived classes, MOOSE allows mission designers to quickly build processes. Ready made FSM-based implementations classes exist within the MOOSE framework that can easily be re-used, and tailored by mission designers through the implementation of Transition Handlers. Each of these FSM implementation classes start either with:

Detailed explanations and API specifics are further below clarified and FSM derived class specifics are described in those class documentation sections.

Disclaimer:

The FSM class development is based on a finite state machine implementation made by Conroy Kyle. The state machine can be found on github I've reworked this development (taken the concept), and created a hierarchical state machine out of it, embedded within the DCS simulator. Additionally, I've added extendability and created an API that allows seamless FSM implementation.

The following derived classes are available in the MOOSE framework, that implement a specialized form of a FSM:


Author: FlightControl

Contributions: funkyfranky


Global(s)

Global FSM

A Finite State Machine (FSM) models a process flow that transitions between various States through triggered Events.

#FSM FSM

A Finite State Machine (FSM) models a process flow that transitions between various States through triggered Events.

A FSM can only be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by an internal or external triggering event, which is called a transition. An FSM implementation is defined by a list of its states, its initial state, and the triggering events for each possible transition. An FSM implementation is composed out of two parts, a set of state transition rules, and an implementation set of state transition handlers, implementing those transitions.

The FSM class supports a hierarchical implementation of a Finite State Machine, that is, it allows to embed existing FSM implementations in a master FSM. FSM hierarchies allow for efficient FSM re-use, not having to re-invent the wheel every time again when designing complex processes.

Workflow Example

The above diagram shows a graphical representation of a FSM implementation for a Task, which guides a Human towards a Zone, orders him to destroy x targets and account the results. Other examples of ready made FSM could be:

  • route a plane to a zone flown by a human
  • detect targets by an AI and report to humans
  • account for destroyed targets by human players
  • handle AI infantry to deploy from or embark to a helicopter or airplane or vehicle
  • let an AI patrol a zone

The MOOSE framework uses extensively the FSM class and derived FSM_ classes, because the goal of MOOSE is to simplify mission design complexity for mission building. By efficiently utilizing the FSM class and derived classes, MOOSE allows mission designers to quickly build processes. Ready made FSM-based implementations classes exist within the MOOSE framework that can easily be re-used, and tailored by mission designers through the implementation of Transition Handlers. Each of these FSM implementation classes start either with:

Transition Rules and Transition Handlers and Event Triggers

The FSM class is the base class of all FSM_ derived classes. It implements the main functionality to define and execute Finite State Machines. The derived FSM_ classes extend the Finite State Machine functionality to run a workflow process for a specific purpose or component.

Finite State Machines have Transition Rules, Transition Handlers and Event Triggers.

The Transition Rules define the "Process Flow Boundaries", that is, the path that can be followed hopping from state to state upon triggered events. If an event is triggered, and there is no valid path found for that event, an error will be raised and the FSM will stop functioning.

The Transition Handlers are special methods that can be defined by the mission designer, following a defined syntax. If the FSM object finds a method of such a handler, then the method will be called by the FSM, passing specific parameters. The method can then define its own custom logic to implement the FSM workflow, and to conduct other actions.

The Event Triggers are methods that are defined by the FSM, which the mission designer can use to implement the workflow. Most of the time, these Event Triggers are used within the Transition Handler methods, so that a workflow is created running through the state machine.

As explained above, a FSM supports Linear State Transitions and Hierarchical State Transitions, and both can be mixed to make a comprehensive FSM implementation. The below documentation has a separate chapter explaining both transition modes, taking into account the Transition Rules, Transition Handlers and Event Triggers.

FSM Linear Transitions

Linear Transitions are Transition Rules allowing an FSM to transition from one or multiple possible From state(s) towards a To state upon a Triggered Event. The Linear transition rule evaluation will always be done from the current state of the FSM. If no valid Transition Rule can be found in the FSM, the FSM will log an error and stop.

FSM Transition Rules

The FSM has transition rules that it follows and validates, as it walks the process. These rules define when an FSM can transition from a specific state towards an other specific state upon a triggered event.

The method FSM.AddTransition() specifies a new possible Transition Rule for the FSM.

The initial state can be defined using the method FSM.SetStartState(). The default start state of an FSM is "None".

Find below an example of a Linear Transition Rule definition for an FSM.

 local Fsm3Switch = FSM:New() -- #FsmDemo
 FsmSwitch:SetStartState( "Off" )
 FsmSwitch:AddTransition( "Off", "SwitchOn", "On" )
 FsmSwitch:AddTransition( "Off", "SwitchMiddle", "Middle" )
 FsmSwitch:AddTransition( "On", "SwitchOff", "Off" )
 FsmSwitch:AddTransition( "Middle", "SwitchOff", "Off" )

The above code snippet models a 3-way switch Linear Transition:

  • It can be switched On by triggering event SwitchOn.
  • It can be switched to the Middle position, by triggering event SwitchMiddle.
  • It can be switched Off by triggering event SwitchOff.
  • Note that once the Switch is On or Middle, it can only be switched Off.

Some additional comments:

Note that Linear Transition Rules can be declared in a few variations:

  • The From states can be a table of strings, indicating that the transition rule will be valid if the current state of the FSM will be one of the given From states.
  • The From state can be a "*", indicating that the transition rule will always be valid, regardless of the current state of the FSM.

The below code snippet shows how the two last lines can be rewritten and condensed.

 FsmSwitch:AddTransition( { "On",  "Middle" }, "SwitchOff", "Off" )

Transition Handling

Transition Handlers

An FSM transitions in 4 moments when an Event is being triggered and processed. The mission designer can define for each moment specific logic within methods implementations following a defined API syntax. These methods define the flow of the FSM process; because in those methods the FSM Internal Events will be triggered.

  • To handle State transition moments, create methods starting with OnLeave or OnEnter concatenated with the State name.
  • To handle Event transition moments, create methods starting with OnBefore or OnAfter concatenated with the Event name.

The OnLeave and OnBefore transition methods may return false, which will cancel the transition!

Transition Handler methods need to follow the above specified naming convention, but are also passed parameters from the FSM. These parameters are on the correct order: From, Event, To:

  • From = A string containing the From state.
  • Event = A string containing the Event name that was triggered.
  • To = A string containing the To state.

On top, each of these methods can have a variable amount of parameters passed. See the example in section 1.1.3.

Event Triggers

Event Triggers

The FSM creates for each Event two Event Trigger methods. There are two modes how Events can be triggered, which is synchronous and asynchronous:

  • The method FSM:Event() triggers an Event that will be processed synchronously or immediately.
  • The method FSM:Event( __seconds ) triggers an Event that will be processed asynchronously over time, waiting x seconds.

The distinction between these 2 Event Trigger methods are important to understand. An asynchronous call will "log" the Event Trigger to be executed at a later time. Processing will just continue. Synchronous Event Trigger methods are useful to change states of the FSM immediately, but may have a larger processing impact.

The following example provides a little demonstration on the difference between synchronous and asynchronous Event Triggering.

  function FSM:OnAfterEvent( From, Event, To, Amount )
    self:T( { Amount = Amount } )
  end

  local Amount = 1
  FSM:__Event( 5, Amount )

  Amount = Amount + 1
  FSM:Event( Text, Amount )

In this example, the :OnAfterEvent() Transition Handler implementation will get called when Event is being triggered. Before we go into more detail, let's look at the last 4 lines of the example. The last line triggers synchronously the Event, and passes Amount as a parameter. The 3rd last line of the example triggers asynchronously Event. Event will be processed after 5 seconds, and Amount is given as a parameter.

The output of this little code fragment will be:

  • Amount = 2
  • Amount = 2

Because ... When Event was asynchronously processed after 5 seconds, Amount was set to 2. So be careful when processing and passing values and objects in asynchronous processing!

Linear Transition Example

This example is fully implemented in the MOOSE test mission on GitHub: FSM-100 - Transition Explanation

It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare. The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build. Have a look at the source code. The source code is also further explained below in this section.

The example creates a new FsmDemo object from class FSM. It will set the start state of FsmDemo to state Green. Two Linear Transition Rules are created, where upon the event Switch, the FsmDemo will transition from state Green to Red and from Red back to Green.

Transition Example

 local FsmDemo = FSM:New() -- #FsmDemo
 FsmDemo:SetStartState( "Green" )
 FsmDemo:AddTransition( "Green", "Switch", "Red" )
 FsmDemo:AddTransition( "Red", "Switch", "Green" )

In the above example, the FsmDemo could flare every 5 seconds a Green or a Red flare into the air. The next code implements this through the event handling method OnAfterSwitch.

Transition Flow

 function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit )
   self:T( { From, Event, To, FsmUnit } )

   if From == "Green" then
     FsmUnit:Flare(FLARECOLOR.Green)
   else
     if From == "Red" then
       FsmUnit:Flare(FLARECOLOR.Red)
     end
   end
   self:__Switch( 5, FsmUnit ) -- Trigger the next Switch event to happen in 5 seconds.
 end

 FsmDemo:__Switch( 5, FsmUnit ) -- Trigger the first Switch event to happen in 5 seconds.

The OnAfterSwitch implements a loop. The last line of the code fragment triggers the Switch Event within 5 seconds. Upon the event execution (after 5 seconds), the OnAfterSwitch method is called of FsmDemo (cfr. the double point notation!!! ":"). The OnAfterSwitch method receives from the FSM the 3 transition parameter details ( From, Event, To ), and one additional parameter that was given when the event was triggered, which is in this case the Unit that is used within OnSwitchAfter.

 function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit )

For debugging reasons the received parameters are traced within the DCS.log.

    self:T( { From, Event, To, FsmUnit } )

The method will check if the From state received is either "Green" or "Red" and will flare the respective color from the FsmUnit.

   if From == "Green" then
     FsmUnit:Flare(FLARECOLOR.Green)
   else
     if From == "Red" then
       FsmUnit:Flare(FLARECOLOR.Red)
     end
   end

It is important that the Switch event is again triggered, otherwise, the FsmDemo would stop working after having the first Event being handled.

   FsmDemo:__Switch( 5, FsmUnit ) -- Trigger the next Switch event to happen in 5 seconds.

The below code fragment extends the FsmDemo, demonstrating multiple From states declared as a table, adding a Linear Transition Rule. The new event Stop will cancel the Switching process. The transition for event Stop can be executed if the current state of the FSM is either "Red" or "Green".

 local FsmDemo = FSM:New() -- #FsmDemo
 FsmDemo:SetStartState( "Green" )
 FsmDemo:AddTransition( "Green", "Switch", "Red" )
 FsmDemo:AddTransition( "Red", "Switch", "Green" )
 FsmDemo:AddTransition( { "Red", "Green" }, "Stop", "Stopped" )

The transition for event Stop can also be simplified, as any current state of the FSM is valid.

 FsmDemo:AddTransition( "*", "Stop", "Stopped" )

So... When FsmDemo:Stop() is being triggered, the state of FsmDemo will transition from Red or Green to Stopped. And there is no transition handling method defined for that transition, thus, no new event is being triggered causing the FsmDemo process flow to halt.

FSM Hierarchical Transitions

Hierarchical Transitions allow to re-use readily available and implemented FSMs. This becomes in very useful for mission building, where mission designers build complex processes and workflows, combining smaller FSMs to one single FSM.

The FSM can embed Sub-FSMs that will execute and return multiple possible Return (End) States. Depending upon which state is returned, the main FSM can continue the flow triggering specific events.

The method FSM.AddProcess() adds a new Sub-FSM to the FSM.


Global FSM_CONTROLLABLE

Models Finite State Machines for Wrapper.Controllables, which are Wrapper.Groups, Wrapper.Units, Wrapper.Clients.

Global FSM_PROCESS

FSM_PROCESS class models Finite State Machines for Tasking.Task actions, which control Wrapper.Clients.

#FSM_PROCESS FSM_PROCESS

FSM_PROCESS class models Finite State Machines for Tasking.Task actions, which control Wrapper.Clients.


Global FSM_SET

FSM_SET class models Finite State Machines for Core.Sets.

#FSM_SET FSM_SET

FSM_SET class models Finite State Machines for Core.Sets.

Note that these FSMs control multiple objects!!! So State concerns here for multiple objects or the position of the state machine in the process.


Global FSM_TASK

Models Finite State Machines for Tasking.Tasks.

#FSM_TASK FSM_TASK

Models Finite State Machines for Tasking.Tasks.


Type(s)

FSM , extends Core.Base#BASE
Fields and Methods inherited from FSM Description

FSM:AddEndState(State)

Adds an End state.

FSM:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

FSM:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

FSM:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

FSM:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

FSM.CallScheduler

Call scheduler.

FSM.ClassName

Name of the class.

FSM.Events

FSM:GetCurrentState()

Get current state.

FSM:GetEndStates()

Returns the End states.

FSM:GetProcess(From, Event)

FSM:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

FSM:GetScores()

Returns a table with the scores defined.

FSM:GetStartState()

Returns the start state of the FSM.

FSM:GetState()

Get current state.

FSM:GetSubs()

Returns a table with the Subs defined.

FSM:GetTransitions()

Returns a table of the transition rules defined within the FSM.

FSM:Is(State)

Check if FSM is in state.

FSM:LoadCallBacks(CallBackTable)

Load call backs.

FSM:New()

Creates a new FSM object.

FSM.Scores

Scores.

FSM:SetProcess(From, Event, Fsm)

FSM:SetStartState(State)

Sets the start state of the FSM.

FSM._EndStates

FSM._EventSchedules

FSM._Processes

FSM._Scores

FSM._StartState

FSM._Transitions

FSM:_add_to_map(Map, Event)

Add to map.

FSM:_call_handler(step, trigger, params, EventName)

Call handler.

FSM:_create_transition(EventName)

Create transition.

FSM:_delayed_transition(EventName)

Delayed transition.

FSM:_eventmap(Events, EventStructure)

Event map.

FSM:_gosub(ParentFrom, ParentEvent)

Go sub.

FSM:_handler(EventName, ...)

Handler.

FSM:_isendstate(Current)

Is end state.

FSM:_submap(subs, sub, name)

Sub maps.

FSM:can(e)

Check if can do an event.

FSM:cannot(e)

Check if cannot do an event.

FSM.current

Current state name.

FSM.endstates

FSM:is(State, state)

Check if FSM is in state.

FSM.options

Options.

FSM.subs

Subs.

Fields and Methods inherited from BASE Description

FSM.ClassID

The ID number of the class.

FSM.ClassName

The name of the class.

FSM.ClassNameAndID

The name of the class concatenated with the ID number of the class.

FSM:ClearState(Object, StateName)

Clear the state of an object.

FSM:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

FSM:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

FSM:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

FSM:CreateEventDynamicCargoLoaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

FSM:CreateEventDynamicCargoRemoved(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

FSM:CreateEventDynamicCargoUnloaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

FSM:CreateEventNewDynamicCargo(DynamicCargo)

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

FSM:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

FSM:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

FSM:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

FSM:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

FSM:E(Arguments)

Log an exception which will be traced always.

FSM:EventDispatcher()

Returns the event dispatcher

FSM:EventRemoveAll()

Remove all subscribed events

FSM:F(Arguments)

Trace a function call.

FSM:F2(Arguments)

Trace a function call level 2.

FSM:F3(Arguments)

Trace a function call level 3.

FSM:GetClassID()

Get the ClassID of the class instance.

FSM:GetClassName()

Get the ClassName of the class instance.

FSM:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

FSM:GetEventPriority()

Get the Class Core.Event processing Priority.

FSM:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

FSM:GetState(Object, Key)

Get a Value given a Key from the Object.

FSM:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

FSM:I(Arguments)

Log an information which will be traced always.

FSM:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

FSM:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

FSM:IsTrace()

Enquires if tracing is on (for the class).

FSM:New()

BASE constructor.

FSM:OnEvent(EventData)

Occurs when an Event for an object is triggered.

FSM:OnEventBDA(EventData)

BDA.

FSM:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

FSM:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

FSM:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

FSM:OnEventDead(EventData)

Occurs when an object is dead.

FSM:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

FSM:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

FSM:OnEventDynamicCargoLoaded(EventData)

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

FSM:OnEventDynamicCargoRemoved(EventData)

Occurs when a dynamic cargo crate is removed.

FSM:OnEventDynamicCargoUnloaded(EventData)

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

FSM:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

FSM:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

FSM:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

FSM:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

FSM:OnEventKill(EventData)

Occurs on the death of a unit.

FSM:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

FSM:OnEventLandingQualityMark(EventData)

Landing quality mark.

FSM:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

FSM:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

FSM:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

FSM:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM:OnEventNewDynamicCargo(EventData)

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

FSM:OnEventParatrooperLanding(EventData)

Weapon add.

FSM:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

FSM:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

FSM:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

FSM:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

FSM:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

FSM:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

FSM:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

FSM:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

FSM:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

FSM:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

FSM:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

FSM:OnEventTriggerZone(EventData)

Trigger zone.

FSM:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

FSM:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

FSM:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

FSM:ScheduleStop(SchedulerID)

Stops the Schedule.

FSM.Scheduler

FSM:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

FSM:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

FSM:T(Arguments)

Trace a function logic level 1.

FSM:T2(Arguments)

Trace a function logic level 2.

FSM:T3(Arguments)

Trace a function logic level 3.

FSM:TraceAll(TraceAll)

Trace all methods in MOOSE

FSM:TraceClass(Class)

Set tracing for a class

FSM:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

FSM:TraceLevel(Level)

Set trace level

FSM:TraceOff()

Set trace off.

FSM:TraceOn()

Set trace on.

FSM:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

FSM:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

FSM._

FSM:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

FSM:_Serialize(Arguments)

(Internal) Serialize arguments

FSM:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

FSM.__

FSM:onEvent(event)

The main event handling function...

Fields and Methods inherited from FSM_CONTROLLABLE Description

FSM_CONTROLLABLE.Controllable

FSM_CONTROLLABLE:GetControllable()

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

FSM_CONTROLLABLE:New(FSMT, Controllable)

Creates a new FSM_CONTROLLABLE object.

FSM_CONTROLLABLE:OnAfterStop(Controllable, From, Event, To)

OnAfter Transition Handler for Event Stop.

FSM_CONTROLLABLE:OnBeforeStop(Controllable, From, Event, To)

OnBefore Transition Handler for Event Stop.

FSM_CONTROLLABLE:OnEnterStopped(Controllable, From, Event, To)

OnEnter Transition Handler for State Stopped.

FSM_CONTROLLABLE:OnLeaveStopped(Controllable, From, Event, To)

OnLeave Transition Handler for State Stopped.

FSM_CONTROLLABLE:SetControllable(FSMControllable)

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

FSM_CONTROLLABLE:Stop()

Synchronous Event Trigger for Event Stop.

FSM_CONTROLLABLE:__Stop(Delay)

Asynchronous Event Trigger for Event Stop.

FSM_CONTROLLABLE:_call_handler(step, trigger, params, EventName)

Fields and Methods inherited from FSM Description

FSM_CONTROLLABLE:AddEndState(State)

Adds an End state.

FSM_CONTROLLABLE:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

FSM_CONTROLLABLE:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

FSM_CONTROLLABLE:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

FSM_CONTROLLABLE:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

FSM_CONTROLLABLE.CallScheduler

Call scheduler.

FSM_CONTROLLABLE.ClassName

Name of the class.

FSM_CONTROLLABLE.Events

FSM_CONTROLLABLE:GetCurrentState()

Get current state.

FSM_CONTROLLABLE:GetEndStates()

Returns the End states.

FSM_CONTROLLABLE:GetProcess(From, Event)

FSM_CONTROLLABLE:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

FSM_CONTROLLABLE:GetScores()

Returns a table with the scores defined.

FSM_CONTROLLABLE:GetStartState()

Returns the start state of the FSM.

FSM_CONTROLLABLE:GetState()

Get current state.

FSM_CONTROLLABLE:GetSubs()

Returns a table with the Subs defined.

FSM_CONTROLLABLE:GetTransitions()

Returns a table of the transition rules defined within the FSM.

FSM_CONTROLLABLE:Is(State)

Check if FSM is in state.

FSM_CONTROLLABLE:LoadCallBacks(CallBackTable)

Load call backs.

FSM_CONTROLLABLE:New()

Creates a new FSM object.

FSM_CONTROLLABLE.Scores

Scores.

FSM_CONTROLLABLE:SetProcess(From, Event, Fsm)

FSM_CONTROLLABLE:SetStartState(State)

Sets the start state of the FSM.

FSM_CONTROLLABLE._EndStates

FSM_CONTROLLABLE._EventSchedules

FSM_CONTROLLABLE._Processes

FSM_CONTROLLABLE._Scores

FSM_CONTROLLABLE._StartState

FSM_CONTROLLABLE._Transitions

FSM_CONTROLLABLE:_add_to_map(Map, Event)

Add to map.

FSM_CONTROLLABLE:_call_handler(step, trigger, params, EventName)

Call handler.

FSM_CONTROLLABLE:_create_transition(EventName)

Create transition.

FSM_CONTROLLABLE:_delayed_transition(EventName)

Delayed transition.

FSM_CONTROLLABLE:_eventmap(Events, EventStructure)

Event map.

FSM_CONTROLLABLE:_gosub(ParentFrom, ParentEvent)

Go sub.

FSM_CONTROLLABLE:_handler(EventName, ...)

Handler.

FSM_CONTROLLABLE:_isendstate(Current)

Is end state.

FSM_CONTROLLABLE:_submap(subs, sub, name)

Sub maps.

FSM_CONTROLLABLE:can(e)

Check if can do an event.

FSM_CONTROLLABLE:cannot(e)

Check if cannot do an event.

FSM_CONTROLLABLE.current

Current state name.

FSM_CONTROLLABLE.endstates

FSM_CONTROLLABLE:is(State, state)

Check if FSM is in state.

FSM_CONTROLLABLE.options

Options.

FSM_CONTROLLABLE.subs

Subs.

Fields and Methods inherited from BASE Description

FSM_CONTROLLABLE.ClassID

The ID number of the class.

FSM_CONTROLLABLE.ClassName

The name of the class.

FSM_CONTROLLABLE.ClassNameAndID

The name of the class concatenated with the ID number of the class.

FSM_CONTROLLABLE:ClearState(Object, StateName)

Clear the state of an object.

FSM_CONTROLLABLE:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

FSM_CONTROLLABLE:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

FSM_CONTROLLABLE:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

FSM_CONTROLLABLE:CreateEventDynamicCargoLoaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

FSM_CONTROLLABLE:CreateEventDynamicCargoRemoved(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

FSM_CONTROLLABLE:CreateEventDynamicCargoUnloaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

FSM_CONTROLLABLE:CreateEventNewDynamicCargo(DynamicCargo)

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

FSM_CONTROLLABLE:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

FSM_CONTROLLABLE:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

FSM_CONTROLLABLE:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

FSM_CONTROLLABLE:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

FSM_CONTROLLABLE:E(Arguments)

Log an exception which will be traced always.

FSM_CONTROLLABLE:EventDispatcher()

Returns the event dispatcher

FSM_CONTROLLABLE:EventRemoveAll()

Remove all subscribed events

FSM_CONTROLLABLE:F(Arguments)

Trace a function call.

FSM_CONTROLLABLE:F2(Arguments)

Trace a function call level 2.

FSM_CONTROLLABLE:F3(Arguments)

Trace a function call level 3.

FSM_CONTROLLABLE:GetClassID()

Get the ClassID of the class instance.

FSM_CONTROLLABLE:GetClassName()

Get the ClassName of the class instance.

FSM_CONTROLLABLE:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

FSM_CONTROLLABLE:GetEventPriority()

Get the Class Core.Event processing Priority.

FSM_CONTROLLABLE:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

FSM_CONTROLLABLE:GetState(Object, Key)

Get a Value given a Key from the Object.

FSM_CONTROLLABLE:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

FSM_CONTROLLABLE:I(Arguments)

Log an information which will be traced always.

FSM_CONTROLLABLE:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

FSM_CONTROLLABLE:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

FSM_CONTROLLABLE:IsTrace()

Enquires if tracing is on (for the class).

FSM_CONTROLLABLE:New()

BASE constructor.

FSM_CONTROLLABLE:OnEvent(EventData)

Occurs when an Event for an object is triggered.

FSM_CONTROLLABLE:OnEventBDA(EventData)

BDA.

FSM_CONTROLLABLE:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

FSM_CONTROLLABLE:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

FSM_CONTROLLABLE:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

FSM_CONTROLLABLE:OnEventDead(EventData)

Occurs when an object is dead.

FSM_CONTROLLABLE:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

FSM_CONTROLLABLE:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

FSM_CONTROLLABLE:OnEventDynamicCargoLoaded(EventData)

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

FSM_CONTROLLABLE:OnEventDynamicCargoRemoved(EventData)

Occurs when a dynamic cargo crate is removed.

FSM_CONTROLLABLE:OnEventDynamicCargoUnloaded(EventData)

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

FSM_CONTROLLABLE:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_CONTROLLABLE:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

FSM_CONTROLLABLE:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

FSM_CONTROLLABLE:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

FSM_CONTROLLABLE:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

FSM_CONTROLLABLE:OnEventKill(EventData)

Occurs on the death of a unit.

FSM_CONTROLLABLE:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_CONTROLLABLE:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

FSM_CONTROLLABLE:OnEventLandingQualityMark(EventData)

Landing quality mark.

FSM_CONTROLLABLE:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

FSM_CONTROLLABLE:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

FSM_CONTROLLABLE:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

FSM_CONTROLLABLE:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_CONTROLLABLE:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_CONTROLLABLE:OnEventNewDynamicCargo(EventData)

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

FSM_CONTROLLABLE:OnEventParatrooperLanding(EventData)

Weapon add.

FSM_CONTROLLABLE:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

FSM_CONTROLLABLE:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

FSM_CONTROLLABLE:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

FSM_CONTROLLABLE:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

FSM_CONTROLLABLE:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

FSM_CONTROLLABLE:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

FSM_CONTROLLABLE:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

FSM_CONTROLLABLE:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

FSM_CONTROLLABLE:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

FSM_CONTROLLABLE:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

FSM_CONTROLLABLE:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

FSM_CONTROLLABLE:OnEventTriggerZone(EventData)

Trigger zone.

FSM_CONTROLLABLE:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

FSM_CONTROLLABLE:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

FSM_CONTROLLABLE:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

FSM_CONTROLLABLE:ScheduleStop(SchedulerID)

Stops the Schedule.

FSM_CONTROLLABLE.Scheduler

FSM_CONTROLLABLE:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

FSM_CONTROLLABLE:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

FSM_CONTROLLABLE:T(Arguments)

Trace a function logic level 1.

FSM_CONTROLLABLE:T2(Arguments)

Trace a function logic level 2.

FSM_CONTROLLABLE:T3(Arguments)

Trace a function logic level 3.

FSM_CONTROLLABLE:TraceAll(TraceAll)

Trace all methods in MOOSE

FSM_CONTROLLABLE:TraceClass(Class)

Set tracing for a class

FSM_CONTROLLABLE:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

FSM_CONTROLLABLE:TraceLevel(Level)

Set trace level

FSM_CONTROLLABLE:TraceOff()

Set trace off.

FSM_CONTROLLABLE:TraceOn()

Set trace on.

FSM_CONTROLLABLE:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

FSM_CONTROLLABLE:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

FSM_CONTROLLABLE._

FSM_CONTROLLABLE:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

FSM_CONTROLLABLE:_Serialize(Arguments)

(Internal) Serialize arguments

FSM_CONTROLLABLE:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

FSM_CONTROLLABLE.__

FSM_CONTROLLABLE:onEvent(event)

The main event handling function...

Fields and Methods inherited from FSM_PROCESS Description

FSM_PROCESS:Assign(Task, ProcessUnit)

Assign the process to a Wrapper.Unit and activate the process.

FSM_PROCESS:Copy(Controllable, Task)

Creates a new FSM_PROCESS object based on this FSM_PROCESS.

FSM_PROCESS:GetCommandCenter()

Gets the mission of the process.

FSM_PROCESS:GetMission()

Gets the mission of the process.

FSM_PROCESS:GetTask()

Gets the task of the process.

FSM_PROCESS:Init(FsmProcess)

FSM_PROCESS:Message(Message)

Send a message of the Tasking.Task to the Group of the Unit.

FSM_PROCESS:New(Controllable, Task)

Creates a new FSM_PROCESS object.

FSM_PROCESS:Remove()

Removes an FSM_PROCESS object.

FSM_PROCESS:SetTask(Task)

Sets the task of the process.

FSM_PROCESS.Task

FSM_PROCESS:_call_handler(step, trigger, params, EventName)

FSM_PROCESS:onenterFailed(ProcessUnit, Task, From, Event, To)

FSM_PROCESS:onstatechange(ProcessUnit, Event, From, To, Task)

StateMachine callback function for a FSM_PROCESS

Fields and Methods inherited from FSM_CONTROLLABLE Description

FSM_PROCESS.Controllable

FSM_PROCESS:GetControllable()

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

FSM_PROCESS:New(FSMT, Controllable)

Creates a new FSM_CONTROLLABLE object.

FSM_PROCESS:OnAfterStop(Controllable, From, Event, To)

OnAfter Transition Handler for Event Stop.

FSM_PROCESS:OnBeforeStop(Controllable, From, Event, To)

OnBefore Transition Handler for Event Stop.

FSM_PROCESS:OnEnterStopped(Controllable, From, Event, To)

OnEnter Transition Handler for State Stopped.

FSM_PROCESS:OnLeaveStopped(Controllable, From, Event, To)

OnLeave Transition Handler for State Stopped.

FSM_PROCESS:SetControllable(FSMControllable)

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

FSM_PROCESS:Stop()

Synchronous Event Trigger for Event Stop.

FSM_PROCESS:__Stop(Delay)

Asynchronous Event Trigger for Event Stop.

FSM_PROCESS:_call_handler(step, trigger, params, EventName)

Fields and Methods inherited from FSM Description

FSM_PROCESS:AddEndState(State)

Adds an End state.

FSM_PROCESS:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

FSM_PROCESS:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

FSM_PROCESS:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

FSM_PROCESS:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

FSM_PROCESS.CallScheduler

Call scheduler.

FSM_PROCESS.ClassName

Name of the class.

FSM_PROCESS.Events

FSM_PROCESS:GetCurrentState()

Get current state.

FSM_PROCESS:GetEndStates()

Returns the End states.

FSM_PROCESS:GetProcess(From, Event)

FSM_PROCESS:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

FSM_PROCESS:GetScores()

Returns a table with the scores defined.

FSM_PROCESS:GetStartState()

Returns the start state of the FSM.

FSM_PROCESS:GetState()

Get current state.

FSM_PROCESS:GetSubs()

Returns a table with the Subs defined.

FSM_PROCESS:GetTransitions()

Returns a table of the transition rules defined within the FSM.

FSM_PROCESS:Is(State)

Check if FSM is in state.

FSM_PROCESS:LoadCallBacks(CallBackTable)

Load call backs.

FSM_PROCESS:New()

Creates a new FSM object.

FSM_PROCESS.Scores

Scores.

FSM_PROCESS:SetProcess(From, Event, Fsm)

FSM_PROCESS:SetStartState(State)

Sets the start state of the FSM.

FSM_PROCESS._EndStates

FSM_PROCESS._EventSchedules

FSM_PROCESS._Processes

FSM_PROCESS._Scores

FSM_PROCESS._StartState

FSM_PROCESS._Transitions

FSM_PROCESS:_add_to_map(Map, Event)

Add to map.

FSM_PROCESS:_call_handler(step, trigger, params, EventName)

Call handler.

FSM_PROCESS:_create_transition(EventName)

Create transition.

FSM_PROCESS:_delayed_transition(EventName)

Delayed transition.

FSM_PROCESS:_eventmap(Events, EventStructure)

Event map.

FSM_PROCESS:_gosub(ParentFrom, ParentEvent)

Go sub.

FSM_PROCESS:_handler(EventName, ...)

Handler.

FSM_PROCESS:_isendstate(Current)

Is end state.

FSM_PROCESS:_submap(subs, sub, name)

Sub maps.

FSM_PROCESS:can(e)

Check if can do an event.

FSM_PROCESS:cannot(e)

Check if cannot do an event.

FSM_PROCESS.current

Current state name.

FSM_PROCESS.endstates

FSM_PROCESS:is(State, state)

Check if FSM is in state.

FSM_PROCESS.options

Options.

FSM_PROCESS.subs

Subs.

Fields and Methods inherited from BASE Description

FSM_PROCESS.ClassID

The ID number of the class.

FSM_PROCESS.ClassName

The name of the class.

FSM_PROCESS.ClassNameAndID

The name of the class concatenated with the ID number of the class.

FSM_PROCESS:ClearState(Object, StateName)

Clear the state of an object.

FSM_PROCESS:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

FSM_PROCESS:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

FSM_PROCESS:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

FSM_PROCESS:CreateEventDynamicCargoLoaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

FSM_PROCESS:CreateEventDynamicCargoRemoved(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

FSM_PROCESS:CreateEventDynamicCargoUnloaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

FSM_PROCESS:CreateEventNewDynamicCargo(DynamicCargo)

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

FSM_PROCESS:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

FSM_PROCESS:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

FSM_PROCESS:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

FSM_PROCESS:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

FSM_PROCESS:E(Arguments)

Log an exception which will be traced always.

FSM_PROCESS:EventDispatcher()

Returns the event dispatcher

FSM_PROCESS:EventRemoveAll()

Remove all subscribed events

FSM_PROCESS:F(Arguments)

Trace a function call.

FSM_PROCESS:F2(Arguments)

Trace a function call level 2.

FSM_PROCESS:F3(Arguments)

Trace a function call level 3.

FSM_PROCESS:GetClassID()

Get the ClassID of the class instance.

FSM_PROCESS:GetClassName()

Get the ClassName of the class instance.

FSM_PROCESS:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

FSM_PROCESS:GetEventPriority()

Get the Class Core.Event processing Priority.

FSM_PROCESS:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

FSM_PROCESS:GetState(Object, Key)

Get a Value given a Key from the Object.

FSM_PROCESS:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

FSM_PROCESS:I(Arguments)

Log an information which will be traced always.

FSM_PROCESS:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

FSM_PROCESS:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

FSM_PROCESS:IsTrace()

Enquires if tracing is on (for the class).

FSM_PROCESS:New()

BASE constructor.

FSM_PROCESS:OnEvent(EventData)

Occurs when an Event for an object is triggered.

FSM_PROCESS:OnEventBDA(EventData)

BDA.

FSM_PROCESS:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

FSM_PROCESS:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

FSM_PROCESS:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

FSM_PROCESS:OnEventDead(EventData)

Occurs when an object is dead.

FSM_PROCESS:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

FSM_PROCESS:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

FSM_PROCESS:OnEventDynamicCargoLoaded(EventData)

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

FSM_PROCESS:OnEventDynamicCargoRemoved(EventData)

Occurs when a dynamic cargo crate is removed.

FSM_PROCESS:OnEventDynamicCargoUnloaded(EventData)

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

FSM_PROCESS:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_PROCESS:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

FSM_PROCESS:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

FSM_PROCESS:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

FSM_PROCESS:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

FSM_PROCESS:OnEventKill(EventData)

Occurs on the death of a unit.

FSM_PROCESS:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_PROCESS:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

FSM_PROCESS:OnEventLandingQualityMark(EventData)

Landing quality mark.

FSM_PROCESS:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

FSM_PROCESS:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

FSM_PROCESS:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

FSM_PROCESS:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_PROCESS:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_PROCESS:OnEventNewDynamicCargo(EventData)

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

FSM_PROCESS:OnEventParatrooperLanding(EventData)

Weapon add.

FSM_PROCESS:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

FSM_PROCESS:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

FSM_PROCESS:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

FSM_PROCESS:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

FSM_PROCESS:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

FSM_PROCESS:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

FSM_PROCESS:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

FSM_PROCESS:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

FSM_PROCESS:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

FSM_PROCESS:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

FSM_PROCESS:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

FSM_PROCESS:OnEventTriggerZone(EventData)

Trigger zone.

FSM_PROCESS:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

FSM_PROCESS:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

FSM_PROCESS:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

FSM_PROCESS:ScheduleStop(SchedulerID)

Stops the Schedule.

FSM_PROCESS.Scheduler

FSM_PROCESS:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

FSM_PROCESS:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

FSM_PROCESS:T(Arguments)

Trace a function logic level 1.

FSM_PROCESS:T2(Arguments)

Trace a function logic level 2.

FSM_PROCESS:T3(Arguments)

Trace a function logic level 3.

FSM_PROCESS:TraceAll(TraceAll)

Trace all methods in MOOSE

FSM_PROCESS:TraceClass(Class)

Set tracing for a class

FSM_PROCESS:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

FSM_PROCESS:TraceLevel(Level)

Set trace level

FSM_PROCESS:TraceOff()

Set trace off.

FSM_PROCESS:TraceOn()

Set trace on.

FSM_PROCESS:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

FSM_PROCESS:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

FSM_PROCESS._

FSM_PROCESS:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

FSM_PROCESS:_Serialize(Arguments)

(Internal) Serialize arguments

FSM_PROCESS:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

FSM_PROCESS.__

FSM_PROCESS:onEvent(event)

The main event handling function...

FSM_SET , extends Core.Fsm#FSM , extends Core.Base#BASE
Fields and Methods inherited from FSM_SET Description

FSM_SET:Get()

Gets the SET_BASE object that the FSM_SET governs.

FSM_SET:New(FSMT, Set_SET_BASE, FSMSet)

Creates a new FSM_SET object.

FSM_SET.Set

FSM_SET:_call_handler(step, trigger, params, EventName)

Fields and Methods inherited from FSM Description

FSM_SET:AddEndState(State)

Adds an End state.

FSM_SET:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

FSM_SET:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

FSM_SET:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

FSM_SET:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

FSM_SET.CallScheduler

Call scheduler.

FSM_SET.ClassName

Name of the class.

FSM_SET.Events

FSM_SET:GetCurrentState()

Get current state.

FSM_SET:GetEndStates()

Returns the End states.

FSM_SET:GetProcess(From, Event)

FSM_SET:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

FSM_SET:GetScores()

Returns a table with the scores defined.

FSM_SET:GetStartState()

Returns the start state of the FSM.

FSM_SET:GetState()

Get current state.

FSM_SET:GetSubs()

Returns a table with the Subs defined.

FSM_SET:GetTransitions()

Returns a table of the transition rules defined within the FSM.

FSM_SET:Is(State)

Check if FSM is in state.

FSM_SET:LoadCallBacks(CallBackTable)

Load call backs.

FSM_SET:New()

Creates a new FSM object.

FSM_SET.Scores

Scores.

FSM_SET:SetProcess(From, Event, Fsm)

FSM_SET:SetStartState(State)

Sets the start state of the FSM.

FSM_SET._EndStates

FSM_SET._EventSchedules

FSM_SET._Processes

FSM_SET._Scores

FSM_SET._StartState

FSM_SET._Transitions

FSM_SET:_add_to_map(Map, Event)

Add to map.

FSM_SET:_call_handler(step, trigger, params, EventName)

Call handler.

FSM_SET:_create_transition(EventName)

Create transition.

FSM_SET:_delayed_transition(EventName)

Delayed transition.

FSM_SET:_eventmap(Events, EventStructure)

Event map.

FSM_SET:_gosub(ParentFrom, ParentEvent)

Go sub.

FSM_SET:_handler(EventName, ...)

Handler.

FSM_SET:_isendstate(Current)

Is end state.

FSM_SET:_submap(subs, sub, name)

Sub maps.

FSM_SET:can(e)

Check if can do an event.

FSM_SET:cannot(e)

Check if cannot do an event.

FSM_SET.current

Current state name.

FSM_SET.endstates

FSM_SET:is(State, state)

Check if FSM is in state.

FSM_SET.options

Options.

FSM_SET.subs

Subs.

Fields and Methods inherited from BASE Description

FSM_SET.ClassID

The ID number of the class.

FSM_SET.ClassName

The name of the class.

FSM_SET.ClassNameAndID

The name of the class concatenated with the ID number of the class.

FSM_SET:ClearState(Object, StateName)

Clear the state of an object.

FSM_SET:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

FSM_SET:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

FSM_SET:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

FSM_SET:CreateEventDynamicCargoLoaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

FSM_SET:CreateEventDynamicCargoRemoved(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

FSM_SET:CreateEventDynamicCargoUnloaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

FSM_SET:CreateEventNewDynamicCargo(DynamicCargo)

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

FSM_SET:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

FSM_SET:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

FSM_SET:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

FSM_SET:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

FSM_SET:E(Arguments)

Log an exception which will be traced always.

FSM_SET:EventDispatcher()

Returns the event dispatcher

FSM_SET:EventRemoveAll()

Remove all subscribed events

FSM_SET:F(Arguments)

Trace a function call.

FSM_SET:F2(Arguments)

Trace a function call level 2.

FSM_SET:F3(Arguments)

Trace a function call level 3.

FSM_SET:GetClassID()

Get the ClassID of the class instance.

FSM_SET:GetClassName()

Get the ClassName of the class instance.

FSM_SET:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

FSM_SET:GetEventPriority()

Get the Class Core.Event processing Priority.

FSM_SET:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

FSM_SET:GetState(Object, Key)

Get a Value given a Key from the Object.

FSM_SET:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

FSM_SET:I(Arguments)

Log an information which will be traced always.

FSM_SET:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

FSM_SET:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

FSM_SET:IsTrace()

Enquires if tracing is on (for the class).

FSM_SET:New()

BASE constructor.

FSM_SET:OnEvent(EventData)

Occurs when an Event for an object is triggered.

FSM_SET:OnEventBDA(EventData)

BDA.

FSM_SET:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

FSM_SET:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

FSM_SET:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

FSM_SET:OnEventDead(EventData)

Occurs when an object is dead.

FSM_SET:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

FSM_SET:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

FSM_SET:OnEventDynamicCargoLoaded(EventData)

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

FSM_SET:OnEventDynamicCargoRemoved(EventData)

Occurs when a dynamic cargo crate is removed.

FSM_SET:OnEventDynamicCargoUnloaded(EventData)

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

FSM_SET:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_SET:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

FSM_SET:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

FSM_SET:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

FSM_SET:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

FSM_SET:OnEventKill(EventData)

Occurs on the death of a unit.

FSM_SET:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_SET:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

FSM_SET:OnEventLandingQualityMark(EventData)

Landing quality mark.

FSM_SET:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

FSM_SET:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

FSM_SET:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

FSM_SET:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_SET:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

FSM_SET:OnEventNewDynamicCargo(EventData)

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

FSM_SET:OnEventParatrooperLanding(EventData)

Weapon add.

FSM_SET:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

FSM_SET:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

FSM_SET:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

FSM_SET:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

FSM_SET:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

FSM_SET:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

FSM_SET:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

FSM_SET:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

FSM_SET:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

FSM_SET:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

FSM_SET:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

FSM_SET:OnEventTriggerZone(EventData)

Trigger zone.

FSM_SET:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

FSM_SET:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

FSM_SET:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

FSM_SET:ScheduleStop(SchedulerID)

Stops the Schedule.

FSM_SET.Scheduler

FSM_SET:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

FSM_SET:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

FSM_SET:T(Arguments)

Trace a function logic level 1.

FSM_SET:T2(Arguments)

Trace a function logic level 2.

FSM_SET:T3(Arguments)

Trace a function logic level 3.

FSM_SET:TraceAll(TraceAll)

Trace all methods in MOOSE

FSM_SET:TraceClass(Class)

Set tracing for a class

FSM_SET:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

FSM_SET:TraceLevel(Level)

Set trace level

FSM_SET:TraceOff()

Set trace off.

FSM_SET:TraceOn()

Set trace on.

FSM_SET:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

FSM_SET:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

FSM_SET._

FSM_SET:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

FSM_SET:_Serialize(Arguments)

(Internal) Serialize arguments

FSM_SET:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

FSM_SET.__

FSM_SET:onEvent(event)

The main event handling function...

FSM_TASK , extends #FSM
Fields and Methods inherited from FSM_TASK Description

FSM_TASK:New(TaskName)

Creates a new FSM_TASK object.

FSM_TASK.Task

FSM_TASK:_call_handler(step, trigger, params, EventName)

Field(s)

#string FSM.ClassName

Name of the class.

#table FSM.Events
#table FSM.Scores

Scores.

#table FSM._Scores
#string FSM._StartState
#string FSM.current

Current state name.

#table FSM.endstates
#table FSM.options

Options.

#table FSM.subs

Subs.

Function(s)

Adds an End state.

Defined in:

FSM

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

FSM

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

FSM

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

FSM

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

FSM

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

FSM

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

FSM

Return value:

#table:

End states.

Defined in:

FSM

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

FSM

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

FSM

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

FSM

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

FSM

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

FSM

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

FSM

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

FSM

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

FSM

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

FSM

Return value:

#FSM:

Defined in:

FSM

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

FSM

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

FSM

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

FSM

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

FSM

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

FSM

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

FSM

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

FSM

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

FSM

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

FSM

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

FSM

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

FSM

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

FSM

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

FSM

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.

Field(s)

#string FSM.ClassName

Name of the class.

#table FSM.Events
#table FSM.Scores

Scores.

#table FSM._Scores
#string FSM._StartState
#string FSM.current

Current state name.

#table FSM.endstates
#table FSM.options

Options.

#table FSM.subs

Subs.

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a dynamic cargo crate is removed.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

Field(s)

Function(s)

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Defined in:

FSM_CONTROLLABLE

Return value:

Creates a new FSM_CONTROLLABLE object.

Defined in:

FSM_CONTROLLABLE

Parameters:

#table FSMT

Finite State Machine Table

(optional) The CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Return value:

OnAfter Transition Handler for Event Stop.

Defined in:

FSM_CONTROLLABLE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnBefore Transition Handler for Event Stop.

Defined in:

FSM_CONTROLLABLE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnEnter Transition Handler for State Stopped.

Defined in:

FSM_CONTROLLABLE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnLeave Transition Handler for State Stopped.

Defined in:

FSM_CONTROLLABLE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Defined in:

FSM_CONTROLLABLE

Parameter:

Return value:

Synchronous Event Trigger for Event Stop.

Defined in:

FSM_CONTROLLABLE

Asynchronous Event Trigger for Event Stop.

Defined in:

FSM_CONTROLLABLE

Parameter:

#number Delay

The delay in seconds.

Defined in:

FSM_CONTROLLABLE

Parameters:

step

trigger

params

EventName

Field(s)

Function(s)

Adds an End state.

Defined in:

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

Return value:

#table:

End states.

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.

Field(s)

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a dynamic cargo crate is removed.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

Field(s)

Function(s)

Assign the process to a Wrapper.Unit and activate the process.

Defined in:

FSM_PROCESS

Parameters:

Wrapper.Unit#UNIT ProcessUnit

Return value:

self

Creates a new FSM_PROCESS object based on this FSM_PROCESS.

Defined in:

FSM_PROCESS

Parameters:

Controllable

Task

Return value:

Gets the mission of the process.

Defined in:

FSM_PROCESS

Return value:

Gets the mission of the process.

Defined in:

FSM_PROCESS

Return value:

Gets the task of the process.

Defined in:

FSM_PROCESS

Return value:

Defined in:

FSM_PROCESS

Parameter:

FsmProcess

Send a message of the Tasking.Task to the Group of the Unit.

Defined in:

FSM_PROCESS

Parameter:

Message

Creates a new FSM_PROCESS object.

Defined in:

FSM_PROCESS

Parameters:

Controllable

Task

Return value:

Removes an FSM_PROCESS object.

Defined in:

FSM_PROCESS

Return value:

Sets the task of the process.

Defined in:

FSM_PROCESS

Parameter:

Return value:

Defined in:

FSM_PROCESS

Parameters:

step

trigger

params

EventName

Defined in:

FSM_PROCESS

Parameters:

ProcessUnit

Task

From

Event

To

StateMachine callback function for a FSM_PROCESS

Defined in:

FSM_PROCESS

Parameters:

#string Event

#string From

#string To

Task

Field(s)

Function(s)

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Creates a new FSM_CONTROLLABLE object.

Defined in:

Parameters:

#table FSMT

Finite State Machine Table

(optional) The CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Return value:

OnAfter Transition Handler for Event Stop.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnBefore Transition Handler for Event Stop.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnEnter Transition Handler for State Stopped.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnLeave Transition Handler for State Stopped.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Defined in:

Parameter:

Return value:

Synchronous Event Trigger for Event Stop.

Asynchronous Event Trigger for Event Stop.

Defined in:

Parameter:

#number Delay

The delay in seconds.

Defined in:

Parameters:

step

trigger

params

EventName

Field(s)

Function(s)

Adds an End state.

Defined in:

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

Return value:

#table:

End states.

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.

Field(s)

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a dynamic cargo crate is removed.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

FSM_SET class

Field(s)

Function(s)

Gets the SET_BASE object that the FSM_SET governs.

Defined in:

FSM_SET

Return value:

Creates a new FSM_SET object.

Defined in:

FSM_SET

Parameters:

#table FSMT

Finite State Machine Table

Set_SET_BASE

FSMSet (optional) The Set object that the FSM_SET governs.

FSMSet

Return value:

Defined in:

FSM_SET

Parameters:

step

trigger

params

EventName

Field(s)

Function(s)

Adds an End state.

Defined in:

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

Return value:

#table:

End states.

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.

Field(s)

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a dynamic cargo crate is removed.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

FSM_TASK class

Field(s)

Function(s)

Creates a new FSM_TASK object.

Defined in:

FSM_TASK

Parameter:

#string TaskName

The name of the task.

Return value:

Defined in:

FSM_TASK

Parameters:

step

trigger

params

EventName