Jump to content

problem Export.lua Data


spinter

Recommended Posts

Black Shark supports only direct data export via Lua, not C or VB, so the easiest thing would be to create a socket using the Lua Socket library, which sends data to your application via TCP or UDP. It should be no problem to write the application in another language, as long as it interprets the byte-stream/-segments it receives from the socket correctly. There is a tutorial about Lua exporting here, which also includes an example of how to communicate via sockets:

 

http://www.digitalcombatsimulator.com/index.php?end_pos=567&scr=default&lang=en

 

However this contains more or less the same information as the Export.lua file itself. Note that both the file and the tutorial above are not completely up to date anymore, so it's a bit of a trial and error process. For example some of the LoXYZ() exporting functions don't work in Black Shark, and there are a lot more new arguments for the LoSetCommand() function to control the Black Shark and the environment.

 

And here you can find the Lua Socket reference:

 

http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/

 

What exactly are you trying to do?


Edited by Acedy
Link to comment
Share on other sites

Spinter what are you trying to do? (so we can help better)

 

To export data in mp, I think server's /config/export/config.lua has to be edited to "EnableExportScript = true"

AMD Ryzen 1400 // 16 GB DDR4 2933Mhz // Nvidia 1060 6GB // W10 64bit // Microsoft Sidewinder Precision 2

Link to comment
Share on other sites

Lua question

 

Hello,

 

I have been reading from the link...

 

http://www.digitalcombatsimulator.com/index.php?end_pos=567&scr=default&lang=en

 

...to learn about lua exporting. I have searched my BS folders, but cannot find the Listener.lua and Talker.lua files the tutorial mentions.

 

I've installed BS to another partition, could it have interferred with the lua files installation?

 

thanks for any help. I really do want to lean more about this...

 

smil

Link to comment
Share on other sites

And here you can find the Lua Socket reference:

 

http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/

 

What exactly are you trying to do?

 

Thanks so much. This sounds like just what the doctor ordered.

 

As for me, I was trying to export to a serial port -- a usb board configured as a serial port -- without much success. I'm thinking now I should configure it as some kind of HID device.

 

So far I've just got it working as a keyboard so I can send keystrokes to the sim.

 

What's everyone else doing?

Link to comment
Share on other sites

Hello,

 

I have been reading from the link...

 

http://www.digitalcombatsimulator.com/index.php?end_pos=567&scr=default&lang=en

 

...to learn about lua exporting. I have searched my BS folders, but cannot find the Listener.lua and Talker.lua files the tutorial mentions.

 

smil

 

I can't find them either. I don't think they exist.

 

What are you trying to do?

 

Let's keep this thread going as a place we can talk about this stuff.

 

Cheers,

Colin

Link to comment
Share on other sites

export is disabled in MP to stop cheating. You would need a server that uses export enabled.

 

My config.lua Enabled EnableExportScript = true ok

 

I export data in singleplayer all ok!

 

multiplayer no export nine data!!!

 

 

 

My example export.lua

 

 

dofile("./Scripts/Aircrafts/Ka-50/Cockpit/devices.lua")

 

 

function LuaExportStart()

dofile("./LuaSocket/Socket.lua")

socket = require("socket")

host = host or "localhost"

port = port or 8080

c = socket.try(socket.connect(host, port)) -- connect to the listener socket

c:setoption("tcp-nodelay",true) -- set immediate transmission mode

socket.try(c:send("Connect"))

end

 

function LuaExportBeforeNextFrame()

 

end

function LuaExportAfterNextFrame()

 

end

function LuaExportActivityNextEvent(t)

local tNext = t

tNext = tNext + 1.0

local R_800 = GetDevice(devices.R_800)

local frequency = R_800:get_frequency()

 

socket.try(c:send(string.format(frequency)))

return tNext

end

 

function LuaExportStop()

-- Works once just after mission stop.

socket.try(c:send("Quit")) -- to close the listener socket

c:close()

end

====VIAF====

Spinter 155° "Pantere Nere"

 

TsSimComms

 

My Site aiupgrade.net

 

 

 

Link to comment
Share on other sites

I can't find them either. I don't think they exist.

 

What are you trying to do?

 

Let's keep this thread going as a place we can talk about this stuff.

 

Cheers,

Colin

 

Thanks, in hindsight I figured those files were from a LockOn installation and not the same as BS. I was just hoping to learn from the examples. I don't even know enough yet to explain what I want to do... :)

 

I have an Epic card setup. Epic is an input/output card from the mid to late nineties. It was mostly used by simmers with MS FS and can use 'pigeon holes' to get data from the flight sim to trigger switches and events in a cockpit. I currently can wire up 512 switches, 16 analog axis, 8 virtual axis and (at this time) 32 lights or outputs. I can run guages, encoders for full motion, ect.

 

I am nowhere near smart enough to do all that alone, but I can get help from several places. I'm trying to learn before I ask so I can make it easier for those that help me. :)

 

I am guessing I need events from BS (at this time I am most intetrested in anunciator and indicator lights) to be true or false, sent to a socket(?) or port with a memory range or ID that the Epic can see (or some program to act between the Epic and flight sim). I believe it uses C++.

 

I really did not mean to hijack the original thread and just want to learn what i can. I'll ask better questions when I can :)

 

thanks

Link to comment
Share on other sites

Thanks, in hindsight I figured those files were from a LockOn installation and not the same as BS. I was just hoping to learn from the examples. I don't even know enough yet to explain what I want to do... :)

 

I have an Epic card setup. Epic is an input/output card from the mid to late nineties. It was mostly used by simmers with MS FS and can use 'pigeon holes' to get data from the flight sim to trigger switches and events in a cockpit. I currently can wire up 512 switches, 16 analog axis, 8 virtual axis and (at this time) 32 lights or outputs. I can run guages, encoders for full motion, ect.

 

I am nowhere near smart enough to do all that alone, but I can get help from several places. I'm trying to learn before I ask so I can make it easier for those that help me. :)

 

I am guessing I need events from BS (at this time I am most intetrested in anunciator and indicator lights) to be true or false, sent to a socket(?) or port with a memory range or ID that the Epic can see (or some program to act between the Epic and flight sim). I believe it uses C++.

 

I really did not mean to hijack the original thread and just want to learn what i can. I'll ask better questions when I can :)

 

thanks

 

Hey JG,

I'm using Epic too.

I wrote a Tool for Lock on two years ago (EpiFC). But only for MCP using QProcs. I'm planing to develop a complete interface for DCS using PH's and Qprocs. But I think it would be clever to wait for the PCIP, so I can avoid Problems with the current "Franken.lua".

Maybe we can share some info.

Regards

 

Raptor


Edited by Maj. Raptor
Link to comment
Share on other sites

  • Recently Browsing   0 members

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