Jason Fayre Posted June 17, 2020 Report Share Posted June 17, 2020 Hi, I've been digging through the FSUIPC manuals, but can't find any specific reference to the ipcReady.lua script. I've got various lua scripts for the A2A c172, c182, Bonanza and Cherokee. I want to have those scripts launch automatically whenever those specific aircraft are loaded. I know I can use the Auto facilities in the ini file to do this, but I want to avoid my users neding to modify there ini files. So, my plan is to do a check in the ipcReady.lua file for the aircraft name and do an ipc.run for the specific scripts when the aircraft is detected. My question is, do scripts that are run with the ipc.run facility terminate when the aircraft changes? For example, if someone has the Bonanza loaded with my script, then they change to the C182, will the Bonanza script terminate and the c182 script run via the ipcReady script? My scripts are all event driven, so they will keep running and waiting for events. If these won't auto terminate when the aircraft changes, what's the best way to do this? Can I add something to my ipcReady script that will kill any already running scripts? Thanks! Link to comment Share on other sites More sharing options...
John Dowson Posted June 18, 2020 Report Share Posted June 18, 2020 17 hours ago, Jason Fayre said: My question is, do scripts that are run with the ipc.run facility terminate when the aircraft changes? No, they don't. They terminate when FSUIPC closes. 17 hours ago, Jason Fayre said: If these won't auto terminate when the aircraft changes, what's the best way to do this? Each of your scripts can also monitor the aircraft name offset, and when this changes they can auto-teminate by calling ipc.exit(). John Link to comment Share on other sites More sharing options...
Jason Fayre Posted June 19, 2020 Author Report Share Posted June 19, 2020 Hi, I'm just getting around to looking at this now. I thought that ipcReady.lua ran any time the aircraft changes. This doesn't seem to be the case. It runs when I load an aircraft after starting the sim, but changing the aircraft doesn't cause it to re-run. Is this the expected behavior? If so, I'm guessing I need to set up an event in ipcReady.lua to monitor the aircraft name offset? Right now, I just have a series of if statements to check for the various aircraft. Link to comment Share on other sites More sharing options...
John Dowson Posted June 19, 2020 Report Share Posted June 19, 2020 You can also use the [Auto.<xxx>] section of your ini (where <xxx> is the profile name) to automatically start/kill luas on aircraft load/change. See the Advanced User guide, section entitled Automatic running of Macros and Lua plugins. John Link to comment Share on other sites More sharing options...
Jason Fayre Posted June 19, 2020 Author Report Share Posted June 19, 2020 Hi John, Using the auto sections is how I was doing things originally. However, since this software is distributed to others, I was trying to avoid having them modify their ini files. the ipcReady method seemed like a cleaner way to do this. Will monitoring for the aircraft name offset in ipcReady work? Link to comment Share on other sites More sharing options...
John Dowson Posted June 20, 2020 Report Share Posted June 20, 2020 16 hours ago, Jason Fayre said: Will monitoring for the aircraft name offset in ipcReady work? You can do that to start your scripts. However, you won't be able to stop them from there when the aircraft changes. To do this, you would also have to monitor the aircraft name in each script so that it can stop itself when the aircraft name changes, as I said. Link to comment Share on other sites More sharing options...
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