kaha Posted May 31, 2023 Report Posted May 31, 2023 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?
John Dowson Posted May 31, 2023 Report Posted May 31, 2023 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now