Banner Image

Module Functional.Autolase

Functional - Autolase targets in the field.


AUOTLASE - Autolase targets in the field.


Missions:

Autolase


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

AUTOLASE.DetectDLINK

AUTOLASE.DetectIRST

AUTOLASE.DetectOptical

AUTOLASE.DetectRWR

AUTOLASE.DetectRadar

AUTOLASE.DetectVisual

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.LaseDistance

AUTOLASE.LaseDuration

AUTOLASE.LaserCodes

AUTOLASE.Menu

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

Constructor for a new Autolase instance.

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:OnEventPlayerEnterAircraft(EventData)

(Internal) Event function for new pilots.

AUTOLASE.RecceLaserCode

AUTOLASE.RecceNames

AUTOLASE.RecceSet

AUTOLASE.RecceSmokeColor

AUTOLASE.RecceUnitNames

AUTOLASE.RecceUnits

AUTOLASE.SRSFreq

AUTOLASE.SRSMod

AUTOLASE.SRSPath

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:SetNotifyPilots(OnOff)

(Internal) Function set notify pilots on events

AUTOLASE:SetPilotMenu()

(Internal) Function to set pilot menu.

AUTOLASE:SetRecceLaserCode(RecceName, Code)

(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)

(User) Function enable sending messages via SRS.

AUTOLASE:ShowStatus(Group)

(Internal) Function to show status.

AUTOLASE:Status()

Triggers the FSM event "Monitor".

AUTOLASE.UnitsByThreat

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.coalition

AUTOLASE.cooldowntime

AUTOLASE.deadunitnotes

AUTOLASE.forcecooldown

AUTOLASE.lasingindex

AUTOLASE.lid

AUTOLASE.maxlasing

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.reporttimelong

AUTOLASE.reporttimeshort

AUTOLASE.smokecolor

AUTOLASE.smoketargets

AUTOLASE.targetsperrecce

AUTOLASE.useSRS

AUTOLASE.usepilotset

AUTOLASE.version

AUTOLASE class version.

Field(s)

AUTOLASE.lid

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

#boolean AUTOLASE.useSRS
#string AUTOLASE.version

AUTOLASE class version.

Function(s)

(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

(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

(Internal) Event function for new pilots.

Defined in:

AUTOLASE

Parameter:

Return value:

self

(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

(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

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-Standalon

#number Frequency

Frequency to send, e.g. 243

#number Modulation

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

Return value:

self

(Internal) Function to show status.

Defined in:

AUTOLASE

Parameter:

(Optional) show to a certain group

Return value:

self

Triggers the FSM event "Monitor".

Defined in:

AUTOLASE

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