Jump to content
The simFlight Network Forums

Dormant lua sometimes not killed when MSFS going to Main menu


LeoSchoonbroodt

Recommended Posts

Hi John,

 

Sometimes i have the problem that a dormant lua script with events isn't killed if MSFS goes to the main menu.
See attached FSUIPC.ini at timemark 7230438 and later.
Don't bother about the LUA.2: RECEIVED: ZZ696691   NOT RECOGNISED/EXECUTED events as this are just Switchstates that are send regularly from the arduinos but not all are used in every aircraft.

This causes problems when i load another plane as the running script keeps the COM ports to my arduinos open and the script for the new plane cannot reach these COM ports.
I attach a logfile that shows that Lua.2 isn't killed when MSFS goes to the main menu for selection of another plane and flight. Subsequently Lua.3 cannot reach the COM ports and Lua.2 keeps processing events.
The lua files run fine, most times.

Also attached the lua files.

Is there a way to automattically kill any running Lua file before loading the next one?

Thanks in advance.

FSUIPC7.log Bell407.lua Alouette.lua

Link to comment
Share on other sites

Can you please also attach your FSUIPC7.ini file.

Also try adding an event.terrminate function where you should close the com ports, and also log a message indicating that the lua is terminating.

Please make this change and resend the files once done and if the problem persists.

Why was the first lua killed and restarted at timestamp 3507594?

 

 

Link to comment
Share on other sites

Hi John, 

I did use a event.terminate function (ExitingLua, last event in the list) where i save some persisted settings when changed and close the com ports.
Problem is that this event is never received, as the lua keeps running and this happened a few times last months.

The first lua was killed by loading it again because i was trying to debug why some offsets wouldn't change when i expected this, but that problem is solved.
Could that maybe be part of the problem, if so i will keep an eye on that too when it happens again.

At the moment i added a event.sim(AIRCRAFTCHANGE, function) which also closes com ports and then exits, just in case the terminate event isn't received.
I will add the logging of the closing of the lua and also send the FSUIPC7.ini file and the profile file for the aircraft that was running when it happens again

BTW i am using latest verion 7.3.25

 

Will keep you posted on this

Thanks

 

Link to comment
Share on other sites

10 hours ago, LeoSchoonbroodt said:

The first lua was killed by loading it again because i was trying to debug why some offsets wouldn't change when i expected this, but that problem is solved.
Could that maybe be part of the problem, if so i will keep an eye on that too when it happens again.

This will be the cause. Only luas that are auto-started are stopped/killed when you go back to the main menu. You are responsible for stopping/killing any lua scripts that you manually started. As the auto started script was killed and manually re-started, it will not be automatically killed.

John

Link to comment
Share on other sites

Thanks for your quick answer John.

So this event.sim AIRCRAFTCHANGE should in fact stop the lua if it's still running when another aircraft is loaded.
Didn't know that only auto-started lua's are killed when going to the main menu.
After re-thinking about it, it's logical, otherwise other non-aircraft-dependant lua's would also be killed.

Thank you

Leo

Link to comment
Share on other sites

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.