mirror of
https://github.com/weyne85/DCS-ExportScripts.git
synced 2025-10-29 16:58:18 +00:00
Add the Maps.lua file to find the map.
Change UDP listener and sender timeout. Optimize export stop send values.
This commit is contained in:
@@ -22,11 +22,12 @@ ExportScript.LastDataDAC = {}
|
|||||||
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\Config.lua]])
|
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\Config.lua]])
|
||||||
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\Tools.lua]])
|
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\Tools.lua]])
|
||||||
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\genericRadio.lua]])
|
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\genericRadio.lua]])
|
||||||
|
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\Maps.lua]])
|
||||||
|
|
||||||
for i = 1, #ExportScript.Config.DAC, 1 do
|
for i = 1, #ExportScript.Config.DAC, 1 do
|
||||||
ExportScript.PacketSizeDAC[i] = 0
|
ExportScript.PacketSizeDAC[i] = 0
|
||||||
ExportScript.SendStringsDAC[i] = {}
|
ExportScript.SendStringsDAC[i] = {}
|
||||||
ExportScript.LastDataDAC[i] = {}
|
ExportScript.LastDataDAC[i] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Frame counter for non important data
|
-- Frame counter for non important data
|
||||||
@@ -46,36 +47,34 @@ function LuaExportStart()
|
|||||||
-- Works once just before mission start.
|
-- Works once just before mission start.
|
||||||
-- (and before player selects their aircraft, if there is a choice!)
|
-- (and before player selects their aircraft, if there is a choice!)
|
||||||
|
|
||||||
-- 2) Setup udp sockets to talk to GlassCockpit
|
-- 2) Setup udp sockets to talk to GlassCockpit
|
||||||
package.path = package.path..";.\\LuaSocket\\?.lua"
|
package.path = package.path..";.\\LuaSocket\\?.lua"
|
||||||
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
|
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
|
||||||
|
|
||||||
ExportScript.socket = require("socket")
|
ExportScript.socket = require("socket")
|
||||||
|
|
||||||
ExportScript.UDPsender = ExportScript.socket.udp()
|
ExportScript.UDPsender = ExportScript.socket.udp()
|
||||||
ExportScript.UDPsender:setsockname("*", 0)
|
ExportScript.UDPsender:setsockname("*", 0)
|
||||||
ExportScript.UDPsender:setoption('broadcast', true)
|
ExportScript.UDPsender:settimeout(.004) -- set the timeout for reading the socket; 250 fps
|
||||||
ExportScript.UDPsender:settimeout(.001) -- set the timeout for reading the socket
|
|
||||||
|
|
||||||
if ExportScript.Config.Listener then
|
if ExportScript.Config.Listener then
|
||||||
ExportScript.UDPListener = ExportScript.socket.udp()
|
ExportScript.UDPListener = ExportScript.socket.udp()
|
||||||
ExportScript.UDPListener:setsockname("*", ExportScript.Config.ListenerPort)
|
ExportScript.UDPListener:setsockname("*", ExportScript.Config.ListenerPort)
|
||||||
ExportScript.UDPListener:setoption('broadcast', true)
|
ExportScript.UDPListener:settimeout(.004) -- set the timeout for reading the socket; 250 fps
|
||||||
ExportScript.UDPListener:settimeout(.001) -- set the timeout for reading the socket
|
end
|
||||||
end
|
|
||||||
|
|
||||||
--local lrename1, lrename2 = os.rename(ExportScript.Config.LogPath, ExportScript.Config.LogPath..".old")
|
--local lrename1, lrename2 = os.rename(ExportScript.Config.LogPath, ExportScript.Config.LogPath..".old")
|
||||||
ExportScript.logFile = io.open(ExportScript.Config.LogPath, "w+")
|
ExportScript.logFile = io.open(ExportScript.Config.LogPath, "w+")
|
||||||
if ExportScript.logFile then
|
if ExportScript.logFile then
|
||||||
ExportScript.logFile:write('\239\187\191') -- create a UTF-8 BOM
|
ExportScript.logFile:write('\239\187\191') -- create a UTF-8 BOM
|
||||||
end
|
end
|
||||||
--if lrenmae1 == nil then
|
--if lrenmae1 == nil then
|
||||||
-- ExportScript.Tools.WriteToLog("Rename Error: "..lrename2)
|
-- ExportScript.Tools.WriteToLog("Rename Error: "..lrename2)
|
||||||
--end
|
--end
|
||||||
|
|
||||||
ExportScript.AF = {} -- Table for Auxiliary functions
|
ExportScript.AF = {} -- Table for Auxiliary functions
|
||||||
|
|
||||||
ExportScript.Tools.SelectModule() -- point globals to Module functions and data.
|
ExportScript.Tools.SelectModule() -- point globals to Module functions and data.
|
||||||
end
|
end
|
||||||
|
|
||||||
function LuaExportBeforeNextFrame()
|
function LuaExportBeforeNextFrame()
|
||||||
@@ -87,13 +86,17 @@ end
|
|||||||
|
|
||||||
function LuaExportStop()
|
function LuaExportStop()
|
||||||
-- Works once just after mission stop.
|
-- Works once just after mission stop.
|
||||||
ExportScript.Tools.SendDataDAC("DAC", "stop")
|
if ExportScript.Config.DACExport then
|
||||||
for i=1, #ExportScript.Config.DAC, 1 do
|
ExportScript.Tools.SendDataDAC("DAC", "stop")
|
||||||
ExportScript.Tools.FlushDataDAC(i)
|
for i=1, #ExportScript.Config.DAC, 1 do
|
||||||
end
|
ExportScript.Tools.FlushDataDAC(i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ExportScript.Tools.SendData("Ikarus", "stop")
|
if ExportScript.Config.IkarusExport then
|
||||||
ExportScript.Tools.FlushData()
|
ExportScript.Tools.SendData("Ikarus", "stop")
|
||||||
|
ExportScript.Tools.FlushData()
|
||||||
|
end
|
||||||
|
|
||||||
ExportScript.UDPsender:close()
|
ExportScript.UDPsender:close()
|
||||||
if ExportScript.Config.Listener then
|
if ExportScript.Config.Listener then
|
||||||
|
|||||||
Reference in New Issue
Block a user