Jump to content

Recommended Posts

Posted (edited)

Hi,

 

Sorry if this is question has been answered already (I've searched the forums and can find no answer), and also sorry for my lack of understanding of export.lua.

 

I am trying to export some statistics for Engine RPM (left and right) via the export.lua script and am encountering difficulty.

 

I have been able to export some default values via the export.lua and config.lua scripts, using some of the examples already provided within export.lua.

 

ie. export.lua

 

function LuaExportStart()
 package.path  = package.path..";.\\LuaSocket\\?.lua"
 package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
 socket = require("socket")
 host = host or "localhost"
 port = port or 6060
 c = socket.try(socket.connect(host, port)) -- connect to the listener socket
 c:setoption("tcp-nodelay",true) -- set immediate transmission mode
end

function LuaExportBeforeNextFrame()
end

function LuaExportAfterNextFrame()
   local t = LoGetModelTime()
   local name = LoGetPilotName()
   local altBar = LoGetAltitudeAboveSeaLevel()
   local altRad = LoGetAltitudeAboveGroundLevel()
   local pitch, bank, yaw = LoGetADIPitchBankYaw()
[b]    local engine = LoGetEngineInfo()
[/b]    socket.try(c:send(string.format("t = %.2f, name = %s, altBar = %.2f, altRad = %.2f, pitch = %.2f, bank = %.2f, yaw = %.2f, RPMLeft = %f, \n", t, name, altBar, altRad, 57.3*pitch, 57.3*bank,57.3*yaw[b], engine.RPM.left[/b])))
end

function LuaExportStop()
   local tNext = t
   return tNext
end

However when I enable the code written above in bold , I am not successful in generating any RPM statistics, without the bold entries added to export.lua then I am successful in exporting the basics.

 

I believe that I must be entering the commands incorrectly to export the table containing the engine information, or in extracting the data to send to the socket.

 

Has anyone had any success in exporting engine information, and can see where my mistakes might lie?

 

On a sidenote, I also made the similar changes to LockOn FC 1.12 and the export is successful, so I can only assume that something has changed with regards to the implementation within BS or the feature has been removed.....?

 

Any assistance would be greatly appreciated.

 

Kind regards,

Bravo020.

Edited by Bravo020
Made some slight corrections.
  • Recently Browsing   0 members

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