Jump to content

Can't export TAS under LuaExportActivityNextEvent(t)


DackSter94

Recommended Posts

Hello,

I'm just messing around with export.lua and I ran into a problem. I'm trying to export time and TAS at intervals of 0.25s into a text file. But TAS always returns nil, so text file is fails to be filled. I tried a lot of variations of the code, but can't seem to get it working...

 

local default_output_file = nil

function LuaExportStart()

default_output_file = io.open(lfs.writedir().."/Logs/Custom.log", "w")

end


function LuaExportActivityNextEvent(t)

local tNext = t
local TAS = LoGetTrueAirSpeed()

default_output_file:write(string.format("t = %.2f, TAS = %.2f\n", t, TAS))


tNext = tNext + 0.25
return tNext

end


function LuaExportStop()

if default_output_file then
	default_output_file:close()
	default_output_file = nil
end

end

LOOK MA, NO HOOK

Link to comment
Share on other sites

Found out that the code works if you set your aircraft to "player". But if you set it to "client" it seems that LoGetTrueAirspeed() returns nil because you are not yet in the aircraft, and then code stops running.

So my next question is how to check if the player has taken the slot already and is in pit, before trying to get TAS value?

  • Like 1

LOOK MA, NO HOOK

Link to comment
Share on other sites

function LuaExportActivityNextEvent(t)

   local tNext = t
   local myData = LoGetSelfData()

   if (myData) then
       local TAS = LoGetTrueAirSpeed()
       default_output_file:write(string.format("t = %.2f, TAS = %.2f\n", t, TAS))
   end

   tNext = tNext + 0.25
   return tNext

LoGetSelfData() get a value, if it a player aircraft.

  • Like 1

Simpit Software by SDA "SIMPIT DEVELOPER ASSOCIATION"

  • DCS ExportScript
  • D.A.C. DCS to Arcaze Communicator
  • Ikarus a new Virtual Cockpit Software

Deutscher Forums Thread

English Forums Thread

 

Hard/Software: AMD Ryzen 7 1800X, 32 GiB RAM, extra SSD for Windows 10 and DCS World, AMD Vega Frontier Edition with 16 GiB VRAM

Link to comment
Share on other sites

function LuaExportActivityNextEvent(t)

   local tNext = t
   local myData = LoGetSelfData()

   if (myData) then
       local TAS = LoGetTrueAirSpeed()
       default_output_file:write(string.format("t = %.2f, TAS = %.2f\n", t, TAS))
   end

   tNext = tNext + 0.25
   return tNext

LoGetSelfData() get a value, if it a player aircraft.

 

Thank you, that worked!

LOOK MA, NO HOOK

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...