Hi,
I am skilled in Java and am currently learning LUA so that i can make a mod fro DCS world and FC3.
However I have a problem in getting the data exported from DCS World FC3 in the Export.lua file to be imported to my Java app and vice verse.
DCS calls the function LuaExportAfterNextFrame every time the simulation frame finishes. So you need to code here your actions to get frame simulations results. For example:
local t = LoGetModelTime()
local name = LoGetPilotName()
local altBar = LoGetAltitudeAboveSeaLevel()
local altRad = LoGetAltitudeAboveGroundLevel()
local pitch, bank, yaw = LoGetADIPitchBankYaw()
Then you can send data to your file:
io.write(string.format("t = %.2f, name = %s, altBar = %.2f, altRad = %.2f, pitch = %.2f, bank = %.2f, yaw = %.2f\n", t, name, altBar, altRad, pitch, bank, yaw))
or to your receiving network program:
socket.try(c:send(string.format("t = %.2f, name = %s, altBar = %.2f, alrRad = %.2f, pitch = %.2f, bank = %.2f, yaw = %.2f\n", t, name, altRad, altBar, pitch, bank, yaw)))
I guess as i have no networking experience, I have a few question:
Should the sim data being set to the Java app be from server if in multiplayer, or just the client PC the Java app is on? I'm thinking the later...
should i transmit data from DCS to the java app by a buffer type io.write or use a port between the two programs? here i think an io.write file will keep network trafic down but don't know aobut maintaining a ever increasing data file and the current line within such. advice?
can you give me a breife pesudo algorithym of how it should be structured?