Banner Image

Module Functional.Autolase

Functional - Autolase targets in the field.


AUOTLASE - Autolase targets in the field.


Missions:

None yet.


Main Features:

  • Detect and lase contacts automatically
  • Targets are lased by threat priority order
  • Use FSM events to link functionality into your scripts
  • Easy setup

  • Spot on!

1 Autolase concept

  • Detect and lase contacts automatically
  • Targets are lased by threat priority order
  • Use FSM events to link functionality into your scripts
  • Set laser codes and smoke colors per Recce unit
  • Easy set-up

2 Basic usage

2.2 Set up a group of Recce Units:

       local FoxSet = SET_GROUP:New():FilterPrefixes("Recce"):FilterCoalitions("blue"):FilterStart()

2.3 (Optional) Set up a group of pilots, this will drive who sees the F10 menu entry:

       local Pilotset = SET_CLIENT:New():FilterCoalitions("blue"):FilterActive(true):FilterStart()

2.4 Set up and start Autolase:

       local autolaser = AUTOLASE:New(FoxSet,coalition.side.BLUE,"Wolfpack",Pilotset)

2.5 Example - Using a fixed laser code and color for a specific Recce unit:

       local recce = SPAWN:New("Reaper")
         :InitDelayOff()
         :OnSpawnGroup(
           function (group)
             local unit = group:GetUnit(1)
             local name = unit:GetName()
             autolaser:SetRecceLaserCode(name,1688)
             autolaser:SetRecceSmokeColor(name,SMOKECOLOR.Red)
           end
         )
         :InitCleanUp(60)
         :InitLimit(1,0)
         :SpawnScheduled(30,0.5)

2.6 Example - Inform pilots about events:

       autolaser:SetNotifyPilots(true) -- defaults to true, also shown if debug == true
       -- Note - message are shown to pilots in the #SET_CLIENT only if using the pilotset option, else to the coalition.

Author: applevangelist

Global(s)

Global AUTOLASE

Type(s)

Fields and Methods inherited from AUTOLASE Description

AUTOLASE:AddBlackListAttributes(Attributes)

(User) Set list of #UNIT level attributes that won't be lased.

AUTOLASE:CanLase(Recce, Unit)

(Internal) Function to check if a unit can be lased.

AUTOLASE:Cancel()

Triggers the FSM event "Cancel".

AUTOLASE:CheckIsLased(unitname)

(Internal) Function to check if a unit is already lased.

AUTOLASE:CleanCurrentLasing()

(Internal) Function to check on lased targets.

AUTOLASE.Culture

AUTOLASE.CurrentLasing

AUTOLASE.DetectDLINK

AUTOLASE.DetectIRST

AUTOLASE.DetectOptical

AUTOLASE.DetectRWR

AUTOLASE.DetectRadar

AUTOLASE.DetectVisual

AUTOLASE:DisableSmokeMenu()

(User) Do not show the "Switch smoke target..." menu entry for pilots.

AUTOLASE:DisableThreatLevelMenu()

(User) Do not show the "Switch min threat lasing..." menu entry for pilots.

AUTOLASE:EnableSmokeMenu()

(User) Show the "Switch smoke target..." menu entry for pilots.

AUTOLASE:EnableThreatLevelMenu()

(User) Show the "Switch min threat lasing..." menu entry for pilots.

AUTOLASE.Gender

AUTOLASE:GetLaserCode(RecceName)

(Internal) Function to get a laser code by recce name

AUTOLASE:GetLosFromUnit(Unit)

(Internal) Function to calculate line of sight.

AUTOLASE:GetSmokeColor(RecceName)

(Internal) Function to get a smoke color by recce name

AUTOLASE.GroupsByThreat

AUTOLASE.Label

AUTOLASE.LaseDistance

AUTOLASE.LaseDuration

AUTOLASE.LaserCodes

AUTOLASE.Menu

AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)

Constructor for a new Autolase instance.

AUTOLASE.NoMenus

AUTOLASE:NotifyPilots(Message, Duration)

(Internal) Function to show messages.

AUTOLASE:NotifyPilotsWithSRS(Message)

(User) Send messages via SRS.

AUTOLASE:OnAfterLaserTimeout(From, Event, To, UnitName, RecceName)

On After "LaserTimeout" event.

AUTOLASE:OnAfterLasing(From, Event, To, LaserSpot)

On After "Lasing" event.

AUTOLASE:OnAfterRecceKIA(From, Event, To, RecceName)

On After "RecceKIA" event.

AUTOLASE:OnAfterTargetDestroyed(From, Event, To, UnitName, RecceName)

On After "TargetDestroyed" event.

AUTOLASE:OnAfterTargetLost(From, Event, To, UnitName, RecceName)

On After "TargetLost" event.

AUTOLASE.PathToGoogleKey

AUTOLASE.Port

AUTOLASE.RecceLaserCode

AUTOLASE.RecceNames

AUTOLASE.RecceSet

AUTOLASE.RecceSmokeColor

AUTOLASE.RecceUnitNames

AUTOLASE.RecceUnits

AUTOLASE.SRS

AUTOLASE.SRSFreq

AUTOLASE.SRSMod

AUTOLASE.SRSPath

AUTOLASE.SRSQueue

AUTOLASE:SetLaserCodes(LaserCodes)

[User] Set a table of possible laser codes.

AUTOLASE:SetLaserCoolDown(OnOff, Seconds)

(User) Function to force laser cooldown and cool down time

AUTOLASE:SetLasingParameters(Distance, Duration)

(User) Function to set lasing distance in meters and duration in seconds

AUTOLASE:SetMaxLasingTargets(Number)

(User) Function set max lasing targets

AUTOLASE:SetMinThreatLevel(Level)

(User) Set minimum threat level for target selection, can be 0 (lowest) to 10 (highest).

AUTOLASE:SetNotifyPilots(OnOff)

(Internal) Function set notify pilots on events

AUTOLASE:SetPilotMenu()

(Internal) Function to set pilot menu.

AUTOLASE:SetRecceLaserCode(RecceName, Code, Refresh)

(User) Function to set a specific code to a Recce.

AUTOLASE:SetRecceSmokeColor(RecceName, Color)

(User) Function to set a specific smoke color for a Recce.

AUTOLASE:SetReportingTimes(long, short)

(User) Function to set message show times.

AUTOLASE:SetSmokeTargets(OnOff, Color)

(User) Function to set smoking of targets.

AUTOLASE:SetUsingSRS(OnOff, Path, Frequency, Modulation, Label, Gender, Culture, Port, Voice, Volume, PathToGoogleKey)

(User) Function enable sending messages via SRS.

AUTOLASE:ShowStatus(Group, Unit)

(Internal) Function to show status.

AUTOLASE:Status()

Triggers the FSM event "Monitor".

AUTOLASE.UnitsByThreat

AUTOLASE.Voice

AUTOLASE.Volume

AUTOLASE:_EventHandler(EventData)

(Internal) Event function for new pilots.

AUTOLASE:__Cancel(delay)

Triggers the FSM event "Cancel" after a delay.

AUTOLASE:__Status(delay)

Triggers the FSM event "Monitor" after a delay.

AUTOLASE.alias

AUTOLASE.blacklistattributes

AUTOLASE.coalition

AUTOLASE.cooldowntime

AUTOLASE.deadunitnotes

AUTOLASE.forcecooldown

AUTOLASE.lasingindex

AUTOLASE.lid

AUTOLASE.maxlasing

AUTOLASE.minthreatlevel

AUTOLASE.notifypilots

AUTOLASE:onafterMonitor(From, Event, To)

(Internal) FSM Function for monitoring

AUTOLASE:onbeforeCancel(From, Event, To)

(Internal) FSM Function onbeforeCancel

AUTOLASE:onbeforeLaserTimeout(From, Event, To, UnitName, RecceName)

(Internal) FSM Function onbeforeLaserTimeout

AUTOLASE:onbeforeLasing(From, Event, To, LaserSpot)

(Internal) FSM Function onbeforeLasing

AUTOLASE:onbeforeMonitor(From, Event, To)

(Internal) FSM Function for monitoring

AUTOLASE:onbeforeRecceKIA(From, Event, To, RecceName)

(Internal) FSM Function onbeforeRecceKIA

AUTOLASE:onbeforeTargetDestroyed(From, Event, To, UnitName, RecceName)

(Internal) FSM Function onbeforeTargetDestroyed

AUTOLASE:onbeforeTargetLost(From, Event, To, UnitName, RecceName)

(Internal) FSM Function onbeforeTargetLost

AUTOLASE.pilotset

AUTOLASE.playermenus

AUTOLASE.reporttimelong

AUTOLASE.reporttimeshort

AUTOLASE.smokecolor

AUTOLASE.smokemenu

AUTOLASE.smoketargets

AUTOLASE.targetsperrecce

AUTOLASE.threatmenu

AUTOLASE.useSRS

AUTOLASE.usepilotset

AUTOLASE.version

AUTOLASE class version.

Field(s)

#boolean AUTOLASE.NoMenus
AUTOLASE.SRS

set up SRS

AUTOLASE.lid

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

#boolean AUTOLASE.useSRS
#string AUTOLASE.version

AUTOLASE class version.

Function(s)

(User) Set list of #UNIT level attributes that won't be lased.

For list of attributes see Hoggit Wiki and GitHub

Defined in:

AUTOLASE

Parameter:

#table Attributes

Table of #string attributes to blacklist. Can be handed over as a single #string.

Return value:

self

Usage:

To exclude e.g. manpads from being lased:

           `myautolase:AddBlackListAttributes("MANPADS")`

To exclude trucks and artillery:

           `myautolase:AddBlackListAttributes({"Trucks","Artillery"})`
           

(Internal) Function to check if a unit can be lased.

Defined in:

AUTOLASE

Parameters:

The Recce #UNIT

The lased #UNIT

Return value:

#boolean:

outcome True or false

Triggers the FSM event "Cancel".

Defined in:

AUTOLASE

(Internal) Function to check if a unit is already lased.

Defined in:

AUTOLASE

Parameter:

#string unitname

Name of the unit to check

Return value:

#boolean:

outcome True or false

(Internal) Function to check on lased targets.

Defined in:

AUTOLASE

Return value:

self

(User) Do not show the "Switch smoke target..." menu entry for pilots.

Defined in:

AUTOLASE

Return value:

self

(User) Do not show the "Switch min threat lasing..." menu entry for pilots.

Defined in:

AUTOLASE

Return value:

self

(User) Show the "Switch smoke target..." menu entry for pilots.

On by default.

Defined in:

AUTOLASE

Return value:

self

(User) Show the "Switch min threat lasing..." menu entry for pilots.

On by default.

Defined in:

AUTOLASE

Return value:

self

(Internal) Function to get a laser code by recce name

Defined in:

AUTOLASE

Parameter:

#string RecceName

Unit(!) name of the Recce

Return value:

self

(Internal) Function to calculate line of sight.

Defined in:

AUTOLASE

Parameter:

Return value:

#number:

LOS Line of sight in meters

(Internal) Function to get a smoke color by recce name

Defined in:

AUTOLASE

Parameter:

#string RecceName

Unit(!) name of the Recce

Return value:

self

Constructor for a new Autolase instance.

Defined in:

AUTOLASE

Parameters:

Set of detecting and lasing units

#number Coalition

Coalition side. Can also be passed as a string "red", "blue" or "neutral".

#string Alias

(Optional) An alias how this object is called in the logs etc.

(Optional) Set of clients for precision bombing, steering menu creation. Leave nil for a coalition-wide F10 entry and display.

Return value:

self

(Internal) Function to show messages.

Defined in:

AUTOLASE

Parameters:

#string Message

The message to be sent

#number Duration

Duration in seconds

Return value:

self

(User) Send messages via SRS.

Defined in:

AUTOLASE

Parameter:

#string Message

The (short!) message to be sent, e.g. "Lasing target!"

Return value:

self

Usage:

Step 1 - set up the radio basics **once** with
           my_autolase:SetUsingSRS(true,"C:\\path\\SRS-Folder",251,radio.modulation.AM)
Step 2 - send a message, e.g.
           function my_autolase:OnAfterLasing(From, Event, To, LaserSpot)
               my_autolase:NotifyPilotsWithSRS("Reaper lasing new target!")
           end

On After "LaserTimeout" event.

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string UnitName

The lost unit's name

#string RecceName

The Recce name lasing

On After "Lasing" event.

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

The LaserSpot data table

On After "RecceKIA" event.

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string RecceName

The lost Recce

On After "TargetDestroyed" event.

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string UnitName

The destroyed unit's name

#string RecceName

The Recce name lasing

On After "TargetLost" event.

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string UnitName

The lost unit's name

#string RecceName

The Recce name lasing

[User] Set a table of possible laser codes.

Each new RECCE can select a code from this table, default is { 1688, 1130, 4785, 6547, 1465, 4578 } .

Defined in:

AUTOLASE

Parameter:

#list<#number> LaserCodes

Return value:

(User) Function to force laser cooldown and cool down time

Defined in:

AUTOLASE

Parameters:

#boolean OnOff

Switch cool down on (true) or off (false) - defaults to true

#number Seconds

Number of seconds for cooldown - dafaults to 60 seconds

Return value:

self

(User) Function to set lasing distance in meters and duration in seconds

Defined in:

AUTOLASE

Parameters:

#number Distance

(Max) distance for lasing in meters - default 5000 meters

#number Duration

(Max) duration for lasing in seconds - default 300 secs

Return value:

self

(User) Function set max lasing targets

Defined in:

AUTOLASE

Parameter:

#number Number

Max number of targets to lase at once

Return value:

self

(User) Set minimum threat level for target selection, can be 0 (lowest) to 10 (highest).

Defined in:

AUTOLASE

Parameter:

#number Level

Level used for filtering, defaults to 0. SAM systems and manpads have level 7 to 10, AAA level 6, MTBs and armoured vehicles level 3 to 5, APC, Artillery, Infantry and EWR level 1 to 2.

Return value:

self

Usage:

Filter for level 3 and above:
           `myautolase:SetMinThreatLevel(3)`

(Internal) Function set notify pilots on events

Defined in:

AUTOLASE

Parameter:

#boolean OnOff

Switch messaging on (true) or off (false)

Return value:

self

(Internal) Function to set pilot menu.

Defined in:

AUTOLASE

Return value:

self

(User) Function to set a specific code to a Recce.

Defined in:

AUTOLASE

Parameters:

#string RecceName

(Unit!) Name of the Recce

#number Code

The lase code

#boolean Refresh

If true, refresh menu entries

Return value:

self

(User) Function to set a specific smoke color for a Recce.

Defined in:

AUTOLASE

Parameters:

#string RecceName

(Unit!) Name of the Recce

#number Color

The color, e.g. SMOKECOLOR.Red, SMOKECOLOR.Green etc

Return value:

self

(User) Function to set message show times.

Defined in:

AUTOLASE

Parameters:

#number long

Longer show time

#number short

Shorter show time

Return value:

self

(User) Function to set smoking of targets.

Defined in:

AUTOLASE

Parameters:

#boolean OnOff

Switch smoking on or off

#number Color

Smokecolor, e.g. SMOKECOLOR.Red

Return value:

self

(User) Function enable sending messages via SRS.

Defined in:

AUTOLASE

Parameters:

#boolean OnOff

Switch usage on and off

#string Path

Path to SRS directory, e.g. C:\Program Files\DCS-SimpleRadio-Standalone

#number Frequency

Frequency to send, e.g. 243

#number Modulation

Modulation i.e. radio.modulation.AM or radio.modulation.FM

#string Label

(Optional) Short label to be used on the SRS Client Overlay

#string Gender

(Optional) Defaults to "male"

#string Culture

(Optional) Defaults to "en-US"

#number Port

(Optional) Defaults to 5002

#string Voice

(Optional) Use a specifc voice with the Sound.SRS#SetVoice function, e.g, :SetVoice("Microsoft Hedda Desktop"). Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.

#number Volume

(Optional) Volume - between 0.0 (silent) and 1.0 (loudest)

#string PathToGoogleKey

(Optional) Path to your google key if you want to use google TTS

Return value:

self

(Internal) Function to show status.

Defined in:

AUTOLASE

Parameters:

(Optional) show to a certain group

(Optional) show to a certain unit

Return value:

self

Triggers the FSM event "Monitor".

Defined in:

AUTOLASE

(Internal) Event function for new pilots.

Defined in:

AUTOLASE

Parameter:

Return value:

self

Triggers the FSM event "Cancel" after a delay.

Defined in:

AUTOLASE

Parameter:

#number delay

Delay in seconds.

Triggers the FSM event "Monitor" after a delay.

Defined in:

AUTOLASE

Parameter:

#number delay

Delay in seconds.

(Internal) FSM Function for monitoring

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

Return value:

self

(Internal) FSM Function onbeforeCancel

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

Return value:

self

(Internal) FSM Function onbeforeLaserTimeout

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string UnitName

The lost unit's name

#string RecceName

The Recce name lasing

Return value:

self

(Internal) FSM Function onbeforeLasing

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

The LaserSpot data table

Return value:

self

(Internal) FSM Function for monitoring

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

Return value:

self

(Internal) FSM Function onbeforeRecceKIA

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string RecceName

The lost Recce

Return value:

self

(Internal) FSM Function onbeforeTargetDestroyed

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string UnitName

The destroyed unit's name

#string RecceName

The Recce name lasing

Return value:

self

(Internal) FSM Function onbeforeTargetLost

Defined in:

AUTOLASE

Parameters:

#string From

The from state

#string Event

The event

#string To

The to state

#string UnitName

The lost unit's name

#string RecceName

The Recce name lasing

Return value:

self