Jump to content
The simFlight Network Forums

Recommended Posts

Posted

How can I get a notification that an aircraft is unloaded in an automatically loaded lua script [AUTO]?

I use a bidirectional com communication between the Arduinos and my lua scripts. My Arduinos know which aircraft is currently loaded and can react accordingly. I do that using the offset event at 0x3D00. Now, as an example, if I go back to main menu in the sim no aircraft is loaded anymore but the Arduino doesn't know.

At the moment the Arduino has to poll the lua script to check if it is still running. It would be nice to have sort of a callback in the lua script that tells me the script is about to end because the aircraft is unloaded.

Any chance to get that?

Posted

You can use event.terminate to get a callback in a lua script before it is stopped.

You can also try with event.sim to get notification of certain sim events, including aircraft change, although  I am not sure how reliable these events are in MSFS.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.