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. |
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 |
---|---|
Enforce case when identifying the Tag, i.e. tag ~= Tag |
|
Name of the class. |
|
Table of keywords to recognize. |
|
Function to instantiate a new #MARKEROPS_BASE object. |
|
On after "MarkAdded" event. |
|
On after "MarkChanged" event. |
|
On after "MarkDeleted" event. |
|
(internal) Handle events. |
|
"Stop" trigger. |
|
Tag to identify commands. |
|
(internal) Match keywords table. |
|
(internal) Match tag. |
|
MARKEROPS_BASE:onbeforeMarkAdded(From, Event, To, Text, Keywords, MarkerID, CoalitionNumber, Coord) |
On before "MarkAdded" event. |
On before "MarkChanged" event. |
|
On before "MarkDeleted" event. |
|
On enter "Stopped" event. |
|
Version of #MARKEROPS_BASE. |
Fields and Methods inherited from FSM | Description |
---|---|
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. |
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. |
Add a new transition rule to the FSM. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
MARKEROPS_BASE:_call_handler(step, trigger, params, EventName) |
Call handler. |
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Check if FSM is in state. |
|
MARKEROPS_BASE class.
Field(s)
Enforce case when identifying the Tag, i.e. tag ~= Tag
Name of the class.
Table of keywords to recognize.
Tag to identify commands.
Set some string id for output to DCS.log file.
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:
self
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.
Core.Point#COORDINATE Coord
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.
Core.Event#EVENTDATA EventData
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.
Core.Point#COORDINATE Coord
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.
Core.Event#EVENTDATA EventData
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.
"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
Core.Point#COORDINATE Coord
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
Core.Point#COORDINATE Coord
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)
Enforce case when identifying the Tag, i.e. tag ~= Tag
Name of the class.
Table of keywords to recognize.
Tag to identify commands.
Set some string id for output to DCS.log file.
Version of #MARKEROPS_BASE.
Function(s)
Adds an End 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.
Core.Fsm#FSM_PROCESS Process
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.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
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.
Sets the start state of the FSM.
Add to map.
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.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
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.