dcsext.ai.commands
DCS AI commands library.
Contents
- Description
- Functions
- _t.wrappedCommand(cmdtbl)
- _t.activateBeacon(unit, freq, bcntype, system, callsign, name, extratbl)
- _t.deactivateBeacon(bcntype)
- _t.activateACLS(unit, name)
- _t.activateICLS(unit, chan, name)
- _t.activateLink4(unit, freq, name)
- _t.createTACAN(unit, callsign, channel, mode, name, aa, bearing, mobile)
- _t.eplrs(enable)
- _t.script(scriptstring)
- _t.setCallsign(callname, num)
- _t.setFrequency(freq, mod, pow)
- _t.setImmortal(enable)
- _t.setInvisible(enable)
- _t.start()
- _t.stopRoute(enable)
- _t.stopTransmission()
- _t.startTransmission(file, duration, loop, subtitle)
Description
A set of helper functions to create command tables which can be passed to Controller:setCommand().
Every public function returns two values: a DCS task table built with the dcsext.ai.exec.createTaskTbl conventions, ready to be passed to a Controller via Controller:setCommand(), and its classification from dcsext.enum.TASKTYPE (COMMAND for en-route commands or TASK for main tasks).
Functions
_t.wrappedCommand(cmdtbl)
Wraps an existing action or command table into a ‘WrappedAction’ task so that raw DCS commands can be embedded in a waypoint task list alongside regular tasks.
Parameters
- cmdtbl
- the action or command table to wrap
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.TASK classification
_t.activateBeacon(unit, freq, bcntype, system, callsign, name, extratbl)
Activates a radio beacon. Passing nil for unit creates a global beacon that is not tied to a specific unit.
Parameters
- unit
- the Unit owning the beacon, or nil for a global beacon
- freq
- beacon frequency as a number
- bcntype
- beacon type from dcsext.enum.BEACON.TYPE
- system
- beacon system from dcsext.enum.BEACON.SYSTEM
- callsign
- station callsign as a string
- name
- (optional) beacon name as a string
- extratbl
- (optional) table of extra command parameters merged over the defaults
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.deactivateBeacon(bcntype)
Deactivates radio beacons.
Parameters
- bcntype
- (optional) value from dcsext.enum.BEACON.DEACTIVATE selecting which beacons to switch off, defaults to ALL
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.activateACLS(unit, name)
Activates the Automatic Carrier Landing System for a unit.
Parameters
- unit
- the Unit to activate ACLS for
- name
- airbase or carrier name as a string
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.activateICLS(unit, chan, name)
Activates an ICLS glideslope beacon for a unit.
Parameters
- unit
- the Unit to activate ICLS for
- chan
- ICLS channel as a number, validated in [1, 20]
- name
- airbase or carrier name as a string
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.activateLink4(unit, freq, name)
Activates a Link4 data link for a unit.
Parameters
- unit
- the Unit to activate Link4 for
- freq
- Link4 frequency as a number
- name
- airbase or carrier name as a string
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.createTACAN(unit, callsign, channel, mode, name, aa, bearing, mobile)
Convenience wrapper that builds a TACAN beacon through activateBeacon(). The matching X/Y system variant is chosen automatically from mode and the aa, bearing and mobile flags.
Parameters
- unit
- the Unit owning the beacon, or nil for a global beacon
- callsign
- station callsign as a string
- channel
- TACAN channel as a number
- mode
- channel banding from dcsext.enum.BEACON.TACANMODE (X or Y)
- name
- (optional) beacon name as a string
- aa
- true selects air-to-air TACAN systems
- bearing
- true adds bearing support to the beacon
- mobile
- true selects mobile ground TACAN systems
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.eplrs(enable)
Toggles the EPLRS datalink for the controlled group.
Parameters
- enable
- true to enable EPLRS, false to disable it
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.script(scriptstring)
Runs Lua source code as a Script command. The source is compiled up front, so syntactically invalid scripts are rejected immediately.
Parameters
- scriptstring
- Lua source code to run as a string
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.setCallsign(callname, num)
Sets the callsign of the controlled group.
Parameters
- callname
- callsign identifier as a number in [1, 20]
- num
- callsign number as a number in [1, 9]
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.setFrequency(freq, mod, pow)
Sets the radio frequency of the controlled group.
Parameters
- freq
- radio frequency as a number
- mod
- modulation from radio.modulation, defaults to AM
- pow
- transmitter power as a number, defaults to 10
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.setImmortal(enable)
Makes the controlled group immortal.
Parameters
- enable
- true to make the group immortal, false otherwise
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.setInvisible(enable)
Makes the controlled group invisible to AI detection.
Parameters
- enable
- true to make the group invisible, false otherwise
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.start()
Starts the engines of the controlled group.
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.stopRoute(enable)
Stops or resumes route following for the controlled group.
Parameters
- enable
- true to stop route following, false to resume it
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.stopTransmission()
Stops any active radio transmission of the controlled group.
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification
_t.startTransmission(file, duration, loop, subtitle)
Transmits an audio file over the radio, optionally repeating it and showing a subtitle.
Parameters
- file
- path of the audio file to transmit as a string
- duration
- (optional) transmission length in seconds as a number
- loop
- (optional) true to repeat the transmission until stopped
- subtitle
- (optional) subtitle text shown during the transmission as a string
Returns
- table the DCS task table for Controller:setCommand()
- number dcsext.enum.TASKTYPE.COMMAND classification