Hi,
Our team is relatively new to DCS but we have been making a few aircraft flight simulators here and there. A few months ago, we got a retired simulator cockpit for an F-16, the sellers didn't provide us with the flight dynamics model / system model. But the shell was working and was open for communication via Opensplice DDS(Data Distribution Service). We have checked all the outputs(indicators/lights) and inputs(stick/throttle etc) by making our own DDS Application and were wondering how to integrate it with DCS to perform a sort of a flight check and compare it with one of the models that we have made inhouse. I looked into DCS BIOS but majority of the posts were about using it with Arduino and communicating via Serial, but we don't want to reverse engineer the cockpit and do all of this again, so I thought about asking here.
Following, some basic tutorials online, I wrote a simple TCP sender but it didn't seem to work, so I took it down a notch, trying to figure out how to basically get some data out by writing it on a file, so I wrote a method for that but I don't know why but it doesn't seem to work at all. Sometimes, the DCS log will have error saying something like "string format error, number expected, got nil" but sometimes it doesn't even show up in the log, there is nothing about Export.lua in there at all like 4 runs out of 5. The Export.lua file I have currently is attached below.
What am I doing wrong? I have experience in C++ and C# but I can't get my head around what is going wrong at the moment. Why is DCS not even giving me an error in it's log file? and if it shouldn't? Why isn't it writing on the file? And what is wrong with the string? Maybe it's an issue with character encoding but I don't know.
Export.lua