Banner Image

Module Core.MarkerOps_Base

Core - Tap into markers added to the F10 map by users.

Main Features:

  • Create an easy way to tap into markers added to the F10 map by users.
  • Recognize own tag and list of keywords.
  • Matched keywords are handed down to functions.

    Listen for your tag

    myMarker = MARKEROPS_BASE:New("tag", {}, false) function myMarker:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord, idx)

end Make sure to use the "MarkChanged" event as "MarkAdded" comes in right after the user places a blank marker and your callback will never be called.


Author: Applevangelist

Date: 5 May 2021 Last Update: Mar 2023


-

Global(s)

Global MARKEROPS_BASE

Fiat lux. -- Latin proverb.

#MARKEROPS_BASE MARKEROPS_BASE

Fiat lux. -- Latin proverb.


The MARKEROPS_BASE Concept

This class enable scripting text-based actions from markers.

Type(s)

Fields and Methods inherited from MARKEROPS_BASE Description

MARKEROPS_BASE.Casesensitive

Enforce case when identifying the Tag, i.e. tag ~= Tag

MARKEROPS_BASE.ClassName

Name of the class.

MARKEROPS_BASE.Keywords

Table of keywords to recognize.

MARKEROPS_BASE:New(Tagname, Keywords, Casesensitive)

Function to instantiate a new #MARKEROPS_BASE object.

MARKEROPS_BASE:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord, MarkerID, CoalitionNumber, PlayerName, EventData)

On after "MarkAdded" event.

MARKEROPS_BASE:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord, MarkerID, CoalitionNumber, PlayerName, EventData)

On after "MarkChanged" event.

MARKEROPS_BASE:OnAfterMarkDeleted(From, Event, To)

On after "MarkDeleted" event.

MARKEROPS_BASE:OnEventMark(Event)

(internal) Handle events.

MARKEROPS_BASE.Stop()

"Stop" trigger.

MARKEROPS_BASE.Tag

Tag to identify commands.

MARKEROPS_BASE:_MatchKeywords(Eventtext)

(internal) Match keywords table.

MARKEROPS_BASE:_MatchTag(Eventtext)

(internal) Match tag.

MARKEROPS_BASE.debug

MARKEROPS_BASE.lid

MARKEROPS_BASE:onbeforeMarkAdded(From, Event, To, Text, Keywords, MarkerID, CoalitionNumber, Coord)

On before "MarkAdded" event.

MARKEROPS_BASE:onbeforeMarkChanged(From, Event, To, Text, Keywords, MarkerID, CoalitionNumber, Coord)

On before "MarkChanged" event.

MARKEROPS_BASE:onbeforeMarkDeleted(From, Event, To)

On before "MarkDeleted" event.

MARKEROPS_BASE:onenterStopped(From, Event, To)

On enter "Stopped" event.

MARKEROPS_BASE.version

Version of #MARKEROPS_BASE.

Fields and Methods inherited from FSM Description

MARKEROPS_BASE:AddEndState(State)

Adds an End state.

MARKEROPS_BASE: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.

MARKEROPS_BASE:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

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

Adds a score for the FSM_PROCESS to be achieved.

MARKEROPS_BASE:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

MARKEROPS_BASE.CallScheduler

MARKEROPS_BASE.Events

MARKEROPS_BASE:GetCurrentState()

Get current state.

MARKEROPS_BASE:GetEndStates()

Returns the End states.

MARKEROPS_BASE:GetProcess(From, Event)

MARKEROPS_BASE:GetProcesses()

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

MARKEROPS_BASE:GetScores()

Returns a table with the scores defined.

MARKEROPS_BASE:GetStartState()

Returns the start state of the FSM.

MARKEROPS_BASE:GetState()

Get current state.

MARKEROPS_BASE:GetSubs()

Returns a table with the Subs defined.

MARKEROPS_BASE:GetTransitions()

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

MARKEROPS_BASE:Is(State)

Check if FSM is in state.

MARKEROPS_BASE:LoadCallBacks(CallBackTable)

Load call backs.

MARKEROPS_BASE:New()

Creates a new FSM object.

MARKEROPS_BASE.Scores

MARKEROPS_BASE:SetProcess(From, Event, Fsm)

MARKEROPS_BASE:SetStartState(State)

Sets the start state of the FSM.

MARKEROPS_BASE._EndStates

MARKEROPS_BASE._EventSchedules

MARKEROPS_BASE._Processes

MARKEROPS_BASE._Scores

MARKEROPS_BASE._StartState

MARKEROPS_BASE._Transitions

MARKEROPS_BASE:_add_to_map(Map, Event)

Add to map.

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

Call handler.

MARKEROPS_BASE:_create_transition(EventName)

Create transition.

MARKEROPS_BASE:_delayed_transition(EventName)

Delayed transition.

MARKEROPS_BASE:_eventmap(Events, EventStructure)

Event map.

MARKEROPS_BASE:_gosub(ParentFrom, ParentEvent)

Go sub.

MARKEROPS_BASE:_handler(EventName, ...)

Handler.

MARKEROPS_BASE:_isendstate(Current)

Is end state.

MARKEROPS_BASE:_submap(subs, sub, name)

Sub maps.

MARKEROPS_BASE:can(e)

Check if can do an event.

MARKEROPS_BASE:cannot(e)

Check if cannot do an event.

MARKEROPS_BASE.current

MARKEROPS_BASE.endstates

MARKEROPS_BASE:is(State, state)

Check if FSM is in state.

MARKEROPS_BASE.options

MARKEROPS_BASE.subs

MARKEROPS_BASE class.

Field(s)

#boolean MARKEROPS_BASE.Casesensitive

Enforce case when identifying the Tag, i.e. tag ~= Tag

#string MARKEROPS_BASE.ClassName

Name of the class.

#table MARKEROPS_BASE.Keywords

Table of keywords to recognize.

#string MARKEROPS_BASE.Tag

Tag to identify commands.

MARKEROPS_BASE.lid

Set some string id for output to DCS.log file.

#string MARKEROPS_BASE.version

Version of #MARKEROPS_BASE.

Function(s)

Function to instantiate a new #MARKEROPS_BASE object.

Defined in:

MARKEROPS_BASE

Parameters:

#string Tagname

Name to identify us from the event text.

#table Keywords

Table of keywords recognized from the event text.

#boolean Casesensitive

(Optional) Switch case sensitive identification of Tagname. Defaults to true.

Return value:

On after "MarkAdded" event.

Triggered when a Marker is added to the F10 map.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state.

#string Event

The Event called.

#string To

The To state.

#string Text

The text on the marker.

#table Keywords

Table of matching keywords found in the Event text.

Coordinate of the marker.

#number MarkerID

Id of this marker.

#number CoalitionNumber

Coalition of the marker creator.

#string PlayerName

Name of the player creating/changing the mark. nil if it cannot be obtained.

the event data table.

On after "MarkChanged" event.

Triggered when a Marker is changed on the F10 map.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state.

#string Event

The Event called.

#string To

The To state.

#string Text

The text on the marker.

#table Keywords

Table of matching keywords found in the Event text.

Coordinate of the marker.

#number MarkerID

Id of this marker.

#number CoalitionNumber

Coalition of the marker creator.

#string PlayerName

Name of the player creating/changing the mark. nil if it cannot be obtained.

the event data table

On after "MarkDeleted" event.

Triggered when a Marker is deleted from the F10 map.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state

#string Event

The Event called

#string To

The To state

(internal) Handle events.

Defined in:

MARKEROPS_BASE

Parameter:

"Stop" trigger.

Used to stop the function an unhandle events

Defined in:

MARKEROPS_BASE

(internal) Match keywords table.

Defined in:

MARKEROPS_BASE

Parameter:

#string Eventtext

Text added to the marker.

Return value:

#table:

(internal) Match tag.

Defined in:

MARKEROPS_BASE

Parameter:

#string Eventtext

Text added to the marker.

Return value:

#boolean:

On before "MarkAdded" event.

Triggered when a Marker is added to the F10 map.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state

#string Event

The Event called

#string To

The To state

#string Text

The text on the marker

#table Keywords

Table of matching keywords found in the Event text

#number MarkerID

Id of this marker

#number CoalitionNumber

Coalition of the marker creator

Coordinate of the marker.

On before "MarkChanged" event.

Triggered when a Marker is changed on the F10 map.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state

#string Event

The Event called

#string To

The To state

#string Text

The text on the marker

#table Keywords

Table of matching keywords found in the Event text

#number MarkerID

Id of this marker

#number CoalitionNumber

Coalition of the marker creator

Coordinate of the marker.

On before "MarkDeleted" event.

Triggered when a Marker is removed from the F10 map.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state

#string Event

The Event called

#string To

The To state

On enter "Stopped" event.

Unsubscribe events.

Defined in:

MARKEROPS_BASE

Parameters:

#string From

The From state

#string Event

The Event called

#string To

The To state

Field(s)

#boolean MARKEROPS_BASE.Casesensitive

Enforce case when identifying the Tag, i.e. tag ~= Tag

#string MARKEROPS_BASE.ClassName

Name of the class.

#table MARKEROPS_BASE.Keywords

Table of keywords to recognize.

#string MARKEROPS_BASE.Tag

Tag to identify commands.

MARKEROPS_BASE.lid

Set some string id for output to DCS.log file.

#string MARKEROPS_BASE.version

Version of #MARKEROPS_BASE.

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.