Introduction

By connecting DCS Mission Scripting lua environment and LotAtc Server you enable:

  • Instructor module with DCS

Installation / Configuration

DCS World modification

DCS Server owner need to patch a file in DCS World directory to enable external socket connection to LotAtc Server.

The file to modify is DCS World/Scripts/ScriptingSystem.lua, you have to add the line:

dofile('Scripts/ScriptingSystem.lua')

-- The following line must be added
dofile(lfs.writedir().."Mods\\services\\LotAtc\\lua utils\\lotatcMissionServer.lua")

Be careful, on each DCS update, this file will be reverted and you have to do the modification again, use OvGME or equivalent is certainly a good idea

Once done, no more modification EVEN if LotAtc Server is updated.

Mission script

If you want LotAtc Server interaction with your mission, you have to add the trigger DO SCRIPT and the line:

lotatcLink.init(_G)

image-left

In this example, I load first Moose.lua, then add some radio item, then init LotAtcLink and then load my example.lua file that will use LotAtcLink and Moose.

Once done, no more need to modify Mission file even on LotAtc Upgrade, all is done in background for you

Dev Area

Introduction

LotAtc Link provides a two-way communication with LotAtc Server. It is in early developpement but possibility are huge:

  • Moving IA
  • Create/Destroy any unit
  • Interact with lua mission flag

As LotAtc is always opened to others projects, the choice has been made to open this link to anybody in order to be used by any lua framework (pure DCS lua, Moose, Mist,…).

I hope that a community can be created around LotAtc Link in order to build fantastic mission with it!

Want to help ?

Join LotAtc Discord and join the #mission-lua-scripting channel!

API

When using LotAtcLink you have to connect your code to LotAtcLink callbacks:

See Saved Games\<DCS Instance>\mods\services\LotAtc\lua utils\example.lua as example.

Here is a complete example to make IA turning with LotAtc Advanced!

env.info("initializing My LotAtc Link example...")
local LCallbacks = {}
LCallbacks.command_status = function(env, msg)
    env.info("LotAtcLink: have version ".. msg.version)
    local _s = string.format("trigger.action.outText('LotAtcLink is connected with LotAtc %s', 10 )", msg.version)
    local f, error_msg = loadstring(_s, "LotAtcLink")
    if f then
        setfenv(f, lotatcLink.mission_env)
        local success, result = pcall(f)
        if success then 
            env.info("LotAtcLink: success")
        else
            env.info("LotAtcLink: failed")
            env.info( error_msg )
            env.info( result )
        end
    end
end
-----------------------------------------
LCallbacks.command_order = function(env, msg)
    if msg.orders then
        env.info("LotAtcLink: receive order")
        for i, order in pairs(msg.orders) do
            local obj = order.object
            env.info("------")
            env.info("   o" .. obj.group_name )
            env.info("   o" .. obj.unit_name )
            env.info("   o" .. obj.property )
            env.info("   o" .. obj.value )
            local _group = GROUP:FindByName( obj.group_name )
            if _group then
                env.info( "Found!" )

                -- Altitude
                if obj.property == "headingDeg" then
                    env.info( "change heading to " .. obj.value )
                    FromCoord = _group:GetCoordinate()
                    ToCoord = FromCoord:Translate( 1000000, tonumber(obj.value) )
                    RoutePoints = {}
                    RoutePoints[#RoutePoints+1] = FromCoord:WaypointAirFlyOverPoint( "BARO", _group:GetVelocityKMH())
                    RoutePoints[#RoutePoints+1] = ToCoord:WaypointAirFlyOverPoint( "BARO", _group:GetVelocityKMH())
                    RouteTask = _group:TaskRoute( RoutePoints )
                    _group:SetTask(RouteTask, 1 )
                end
            end
        end
    end
end

-----------------------------------------
lotatcLink.registerCallbacks( LCallbacks )
-----------------------------------------
env.info("My LotAtc Link initialized")
Callback Description Parameters
command_status First call when LotAtcLink is initialized data.version contains LotAtc Version used
command_order Call on each LotAtc Instructor command data.orders contains one or more orders to execute (see orders below)

Orders

A lua order object have:

order.object

Member Description
group_name DCS Group name
unit_name DCS Unit name
property Property name that changes
value New value

Property can be:

Name Description
headingDeg new heading in degrees
altitude new altitude in meters
groundSpeed new ground speed in km/h

Updated: