-- Uncomment if using Vector class from the Config/Export/Vector.lua file --[[ -- LUA_PATH = "?;?.lua;./Config/Export/?.lua" -- require 'Vector' -- See the Config/Export/Vector.lua file for Vector class details, please. --]] local default_output_file = nil function LuaExportStart() package.path = package.path..";.\\LuaSocket\\?.lua" package.cpath = package.cpath..";.\\LuaSocket\\?.dll" 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 function LuaExportBeforeNextFrame() dofile(lfs.writedir()..'Scripts\\cdu_data.luac') --dofile(lfs.writedir()..'Scripts\\cdu_data.luac') end function LuaExportAfterNextFrame() local t = LoGetModelTime() local altBar = LoGetAltitudeAboveSeaLevel() local altRad = LoGetAltitudeAboveGroundLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local vel = LoGetVerticalVelocity() local angle = 0 local accel = LoGetAccelerationUnits() local trueairspeed = LoGetTrueAirSpeed() local slipball = LoGetSlipBallPosition() local velocityvector = LoGetVectorVelocity() local vel_v = LoGetVectorVelocity() -- (1 m/s), vel_v.x, vel_v.y, vel_v.z local user1 = 1 local user2 = 2 local user3 = vel_v.y local user4 = vel_v.x --TAS local user5 = vel --Pitch value somehow local user6 = vel_v.z if c then socket.try(c:send(string.format("%.3f %.2f %.2f %.2f %.2f %.2f %.2f %.0f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f \n", t, altRad, altBar, pitch*1000.0, bank*1000.0, yaw*1000.0, accel.x*1000.0, angle*1000, accel.y*1000.0, accel.z*1000.0, accel.x*1000.0, (accel.y-1)*1000.0, accel.z*1000.0, user3, user4, user5, user6, 7))) end end function LuaExportStop() if default_output_file then default_output_file:close() default_output_file = nil end -- 2) Socket socket.try(c:send("quit")) -- to close the listener socket c:close() end -- New entry from original Export.lua (2015). Important for Aries and Flightplaner function LuaExportActivityNextEvent(t) local tNext = t return tNext end local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[Scripts\DCS-SimpleRadioStandalone.lua]]) -- dofile ( lfs.writedir()..'Scripts\\Tacnoworld_UR_DCSW.luac' )