Jump to content

Recommended Posts

Posted

A little problem, as soon as I add the "local inpst = socket.try(c:receive())" to LuaExportBeforeNextFrame() I get a

Lua::Config::call error LuaExportBeforeNextFrame:(null) 

in the error log, presumably 1x error per frame => error log grows quickly.

 

If I remove the local inpst = socket.try(c:receive()) the error goes away.

 

Everything works though, I get data on the socket etc so the only problem is the huge log file after a couple of minutes of playing.

 

One theory that I have is that the error is a result of calling "socket.try(c:receive())" when there is no data waiting on the socket ( = > 99.99% of the time).

 

Anybody have any ideas?

 

 

/Oakes

 



function LuaExportBeforeNextFrame()
-- Works just before every simulation frame.

-- Call Lo*() functions to set data to Lock On here
-- For example:
--    LoSetCommand(3, 0.25) -- rudder 0.25 right 
--    LoSetCommand(64) -- increase thrust
--io.write("---Log: Check for packet on Socket-----", "\n")
   local inpst = socket.try(c:receive())
   
   if inpst then
       io.write("---Log: Packet on Socket-----", "\n")
       io.write(inpst.."\n")
   
       for lSIOC_Param, lSIOCValue in SIOC_Parse(inpst) do
           local lInputsTable = inputsTable
           if lInputsTable[lSIOC_Param] ~= nil then
           --    io.write(lInputsTable[lSIOC_Param][4].."\n")
               lInputsTable[lSIOC_Param][1](lSIOCValue, lInputsTable[lSIOC_Param][2],lInputsTable[lSIOC_Param][3],lInputsTable[lSIOC_Param][4],lInputsTable[lSIOC_Param][5])
           end          
       end
   
   


end


Posted

Tried without the try, worked like a charm, not completely certain what potential side effects etc this has....need to dig a little deeper into LUASockets.:helpsmilie:

 

Thanks Colin

 

/Oakes

  • 3 weeks later...
Posted (edited)

I made a compilation between devices.lua and clickbledata.lua to help developping for SIOC

 

-- A file intended to help programming SIOC interface to build cockpit for DCS-BS

 

-- in stock BS folders you find

-- \scripts\aircrafts\ka-50\cockpit\devices.lua which is sorted by devices index

-- \scripts\aircrafts\ka-50\cockpit\clikabledata.lua which is sorted by panels organisation in cockpit

 

-- to build a cockpit using OpenCockpit interface cards and SIOC software you need to know devices index for each button

-- I was bored searching in clickable data.lua and devices.lua so I made this compilation

 

-- This file is a compilation from \scripts\aircrafts\ka-50\cockpit\devices.lua and clickabledata.lua

 

-- in which each button is sorted by is index number, all buttons are grouped by device index number.

-- type of button and arguments are copied also to help programing SIOC

 

-- I hope forgot nothing but fastidious to verify... so if anyone find errors ... feel free to post a comment for edition and correction

 

-- IMPORTANT : don't paste this file "as is" in BS folders... it ain't work that way ...

 

-- I named it ".lua" because of syntax color in Notepad++ the editor I use, it's easier to read and edit !

 

-- Hellfrog @ C6 french forums

 

SIOC_BS_help.zip

Edited by C6_Hellfrog
update
  • Recently Browsing   0 members

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