DCS command script

From DCS World Wiki - Hoggitworld.com


Task: Script Added with: 1.2.4
Hierarchy: Scripting Root > Tasks > Command > Script
Tasking Type: Command
For: Airplanes, Helicopters, Ground Vehicles, Ships
Available Under: All tasks types
Description: Runs lua script. Script can feature the the special identifier ... as a self variable referencing the group object the script is running within.
Format: This task needs to be in the following format.
Script = { 
  id = 'Script', 
  params = { 
    command = string  
  } 
}

Required parameters:

command: Any valid lua string


Optional Parameters:

Enumerators: N/A
Examples: The following would be used to automatically update a table with the current waypoint an AI group is on. The first segment of code is a globally accessible function that will populate and +1 the value associated with a given group.
   local aiCurrentWaypoints = {}
   function iterWP(gp)
       local gName = gp:getName()
       if not aiCurrentWaypoints[gName] then
          aiCurrentWaypoints[gName] = 0
       end
       aiCurrentWaypoints[gName] = aiCurrentWaypoints[gName] + 1
   end

The following would need to be added to every single waypoint as a script command for the groups you wish to update their WP status.

   local gp = ... 
   iterWP(gp)
Notes: See article Mission Editor: AI Tasking for more information on how AI tasking is handled within DCS.

See: Lua documentation on variable number of arguments in DCS this variable can be used within the script and script file group tasks to reference the "self" group object of the group.

Task List: Task Wrappers: mission, ComboTask, ControlledTask, WrappedAction


Tasks: AttackGroup, AttackUnit, Bombing, Strafing, CarpetBombing, AttackMapObject, BombingRunway, orbit, refueling, land, follow, followBigFormation, escort, Embarking, fireAtPoint, hold, FAC_AttackGroup, EmbarkToTransport, DisembarkFromTransport, CargoTransportation, goToWaypoint, groundEscort, RecoveryTanker

En-route Tasks: engageTargets, engageTargetsInZone, engageGroup, engageUnit, awacs, tanker, ewr, FAC_engageGroup, FAC

Commands: script, setCallsign, setFrequency, setFrequencyForUnit, switchWaypoint, stopRoute, switchAction, setInvisible, setImmortal, setUnlimitedFuel, activateBeacon, deactivateBeacon, activateICLS, deactivateICLS, eplrs, start, transmitMessage, stopTransmission, smoke_on_off, ActivateLink4, deactivateLink4, activateACLS, deactivateACLS, LoadingShip

Options: ROE, Reaction To Threat, Radar Using, Flare Using, Formation, RTB On Bingo, silence, Disperse on Attack, Alarm State, RTB on Out of Ammo, ECM Using, Prohibit AA, Prohibit Jettison, Prohibit Afterburner, Prohibit AG, Missile Attack Range, Prohibit WP Pass Report, Engage Air Weapons, Option Radio Usage Contact, Option Radio Usage Engage, Option Radio Usage Kill, AC Engagement Range Restriction, jett tanks if empty, forced attack, Altitude Restriction for AAA Min, restrict targets, Altitude Restriction for AAA Max, Prefer Vertical, Evasion Of ARM, Formation Interval