Jump to content

Recommended Posts

Posted

Someone wrote a program that controls the ilumination of the buttons on the G940 throttle (sorry, can't remember who that was ...). It was "remote controlled" via network by a .LUA script that was hooked into the Export.lua.

 

It was set up as coroutine that was called several times per second. It read the status of some cockpit devices and sent an control command to that external program which then enabled/disabled the throttle buttons. I used this to replicate the targetting system buttons and the AP buttons of the Ka-50 on my throttle.

 

As such, it worked like a charm. But I had crashes whenever I crashed or ejected ("DCS stopped responding"). The .DMP showed me that an "Access Violation" occured in "CockpitBase.dll" - that got me thinking. Now I am confident that the LUA is responsible for that: as coroutine it accesses cockpit devices asynchronously. But if the cockpit suddenly disappears (crash, eject), what happens if it still continues to try to access the cockpit devices? :o)

 

So, now my question: how do I do it right? How do I prevent that script from calling functions that require a working cockpit, if the cockpit isn't available anymore? Can I detect that somehow? Or could I use a different technique instead of coroutines - which still allow continous refreshes/updates being sent? (I can't just put the functionality directly into the Export.lua as that would conflict with other export scripts (TacView))

  • Recently Browsing   0 members

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