Jump to content
The simFlight Network Forums

Recommended Posts

Posted

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!

 

 

 

 

Posted
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

Posted

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.

 

Posted

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

Posted

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?

 

 

 

Posted
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.

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.