DCS export

From DCS World Wiki - Hoggitworld.com


DCS allows for the export of data within the game world to be used by a wide variety of applications. Example include tacview, simple radio, and physical cockpits.

Luasocket

DCS supplies LuaSocket 2.0 Beta files in the Scripts\LuaSocket folder and in the DCS installation folder. You can use LuaSocket to establish standard network connection between the Export.lua script and your local or remote program. Look into the Scripts\LuaSocket folder and find Listener.lua and Talker.lua files. You can use them as stand alone examples for Lua script networking.

Export.lua

At the top of Export.lua, there's some comments about it's use

-- Data export scripts 
-- Copyright (C) 2004, Eagle Dynamics.
-- …
The Lua language use two sequential dashes "--" to start the single-line comment to the end of line. If you need to comment several lines then use "--" and "--" brackets:
-- Uncomment this function to enable data export!
--[[ 
function LuaExportStart()
-- Works once just before mission start.

-- Make initializations of your files or connections here.
-- For example:
-- 1) File
--	local file = io.open("./Temp/Export.log", "w")
--	if file then
--	io.output(file)
--	end
-- 2) Socket
-- dofile "lua.lua"
-- socket = require("socket")
-- host = host or "localhost"
-- port = port or 8080
-- c = socket.try(socket.connect(host, port)) -- connect to the listener socket
-- c:setoption("tcp-nodelay",true) -- set immediate transmission mode 

end
--]]

DCS activates the Config\Export\Export.lua script at every mission start. You need to uncomment the function LuaExportStart to activate it and to activate all other functions. For that add the single "-" just before "--[[" opening multi-line comment to convert it to the single-line comment "---[[". So the closing multi-line comment bracket without opening one becomes the single-line comment too. If you want to disable exporting features then remove additional third dash to make the comment multi-line again.


Multiplayer

When playing the game in single player every command is available, however in multiplayer there are options to disable specific settings as desired by the server creator. There are three options as defined by the following:

Object

Allows for all objects to be accessible. For example this is how tacview knows and returns where every single object in the game is at.

 LoGetObjectById
 LoGetWorldObjects

Sensor

Exports sensor data from your aircraft.

 LoGetTWSInfo
 LoGetTargetInformation
 LoGetLockedTargetInformation
 LoGetF15_TWS_Contacts
 LoGetSightingSystemInfo
 LoGetWingTargets

Ownship

Exports data about your own aircraft. For example simple radio uses one of these to get the players current location and radio information.

 LoGetPlayerPlaneId
 LoGetIndicatedAirSpeed
 LoGetAngleOfAttack
 LoGetAngleOfSideSlip
 LoGetAccelerationUnits
 LoGetVerticalVelocity
 LoGetADIPitchBankYaw
 LoGetTrueAirSpeed
 LoGetAltitudeAboveSeaLevel
 LoGetAltitudeAboveGroundLevel
 LoGetMachNumber
 LoGetRadarAltimeter
 LoGetMagneticYaw
 LoGetGlideDeviation
 LoGetSideDeviation
 LoGetSlipBallPosition
 LoGetBasicAtmospherePressure
 LoGetControlPanel_HSI
 LoGetEngineInfo
 LoGetSelfData
 LoGetCameraPosition
 LoSetCameraPosition
 LoSetCommand
 LoGetMCPState
 LoGetRoute
 LoGetNavigationInfo
 LoGetPayloadInfo
 LoGetWingInfo
 LoGetMechInfo
 LoGetRadioBeaconsStatus
 LoGetVectorVelocity
 LoGetVectorWindVelocity
 LoGetSnares
 LoGetAngularVelocity
 LoGetHeightWithObjects
 LoGetFMData

Always

 LoGetPilotName
 LoGetAltitude
 LoGetNameByType
 LoGeoCoordinatesToLoCoordinates
 LoCoordinatesToGeoCoordinates
 LoGetVersionInfo
 LoGetWindAtPoint
 LoGetModelTime
 LoGetMissionStartTime