Jump to content

Lua Export bugs in BS?


Recommended Posts

I've been doing some testing and was wondering if there are some bugs in the system or if it's just me, but some export functions don't seem to work. For example altitude exports, bank angle and true airspeed seem to work, but indicated airspeed, slip ball position and vertical velocity return only nil values. The config file has "true" in it to allow export, I've tested mostly in singleplayer mode and I have the Russian download version. Any ideas?

My blog full of incoherent ramblings on random subjects: https://anttiilomaki.wordpress.com/

Link to comment
Share on other sites

Ok, the new functionalities seem to work pretty well in single player, but in multi I get error message

 

Dispatcher::Can't execute Lua file ./Config/Export/Export.lua - ./Config/Export/Export.lua:79: attempt to call global 'GetDevice' (a nil value)

 

EnableExportScript = true in the Configlua file.

 

Anyway, I've had a look at the new export file and things look very promising indeed. There are many interesting and useful new export options, ED really seems to care about us crazy people building cockpit stuff.

My blog full of incoherent ramblings on random subjects: https://anttiilomaki.wordpress.com/

Link to comment
Share on other sites

Hello,

I wrote a message in an other forum (dedicated in russian language)

I need an help regarding the export.lua and the socket using. there is an error as soon as I write the buffer.

I want to use the socket.

I developped a mod for the keyboard G15 and his LCD screen.

http://sebcanaud.free.fr/Perso/LOCKO...LockonV1.3.zip (my job)

Under lockon, I get informations and display them on the G15. I want to do the same job with BS.

 

But I have this error

 

very simple export.lua file

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 LuaExportAfterNextFrame()

local h = LoGetAltitudeAboveSeaLevel()

socket.try(c:send(string.format("h = %f\n",h))) -- line 131

end

 

I execute the game and I have that error on the log file and nothing on the socket.

 

Error.log

-----------------------------------

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

Lua::Config::call error LuaExportAfterNextFrame:./Config/Export/Export.lua:131: attempt to index global 'c' (a nil value)

 

Do you have an idea please

Regards

Seb

Link to comment
Share on other sites

'c' is nil if connection fail.

 

Check your application - it's listening on UDP port, may be more "best practice" is use TCP port (i'm use TCP instead of UDP)?

UDP 0.0.0.0:6060 *:* 137096

Всё сказанное автором - вымесел, и не может быть использовано как доказательство в суде.

Мой блог | My blog

Link to comment
Share on other sites

but that means BS needs to have an other application TCP to works?

not quite understand the question...



BS require TCP-listening application (aka socket-server) to communicate via socket. In this case BS - client, your application - server.

Всё сказанное автором - вымесел, и не может быть использовано как доказательство в суде.

Мой блог | My blog

Link to comment
Share on other sites

BS require TCP-listening application (aka socket-server) to communicate via socket. In this case BS - client, your application - server.

hello,

I understood my mistake.

As soon as I m back home I will test a TCP socket.

For LO I developped a UDP socket based on WinSock32

But why I need to be the server ? not the client?

I never developed any thing using TCP and I m not very good in socket.

I founded a example using Winsock32 to modify my sources. But I have to use "Server" example?

Link to comment
Share on other sites

For LO I developped a UDP socket based on WinSock32.

But why I need to be the server ? not the client?

IMHO - it's easy. In my case.

If you make a server in Lua easier than WinSock - do it in Lua

Всё сказанное автором - вымесел, и не может быть использовано как доказательство в суде.

Мой блог | My blog

Link to comment
Share on other sites

Send or Receive - no matters.

When you start browser and connect to web-server you send "request"-message, and web-server is response.

In this case you browser is client, even if it send information.

 

In case of Export.lua this is not a axiom. It's only your choice - creating client or server. Do it as you best.

Всё сказанное автором - вымесел, и не может быть использовано как доказательство в суде.

Мой блог | My blog

Link to comment
Share on other sites

  • 1 year later...

who is the server and who is the client is a matter of which program connects to the other and which program is listening for connections. in this case your program has to be startet first to listen for connections and DCS will connect to your program when the sim starts (at least in case you use the socket:connect()-example in the export.lua). that's why DCS is the client and your program is the server. no matter in which direction most of the data is transmitted.


Edited by gofrm76

AH-64D | AV-8B | A-10C II | A-4E | F-4E | F-5E | F-14B | F-15E | F-16C | F/A-18C | M-2000C | UH-1H | Mig-21bis | L-39 | F-86F | P-47D | P-51D | BF 109 | Spitfire | BS3 | FC3 | SC | CA

Intel® Core™ i7-13700K | NVIDIA RTX 4090 | 64 GB DDR5 RAM | Aorus Elite Z790 | 50“ UHD LG Monitor | Windows 11 Pro

VPC Rotor TCS Plus Base | VPC Apache-64 Collective Grip | VPC Hawk-60 Collective Grip | VPC MongoosT-50CM3 Base | TM F-16/A-10 Stick  | TM F/A-18 Stick

TM HOTAS Warthog (DSE Slew Upgrade) | TM Hotas Cougar (FSSB) | TM Pendular Rudder | HP Reverb G2 | TrackIR 5

Link to comment
Share on other sites

  • Recently Browsing   0 members

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