Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello John,

I'm not at my PC so I can't "Add Files". But I do have a question if I may.

I'm trying to execute an Lua function based on the routine "event.sim".

It's coded event.sim(FLIGHTLOAD,"StartLVar"). I want the code to kick off when a flight is started - "Fly Now". The Lua is loaded and stops at "waiting for an event".

Is this routine still available and where in the schema does it light off?

Thanks

Posted
4 hours ago, DaveSCUSA said:

It's coded event.sim(FLIGHTLOAD,"StartLVar"). I want the code to kick off when a flight is started - "Fly Now". The Lua is loaded and stops at "waiting for an event".

Is this routine still available and where in the schema does it light off?

The problem with this is that the flight would already have been loaded/started by the time the lua is started, so this function will only be called if/when a new flight is loaded.
Lua scripts are not started until AFTER the aircraft (and also initial flight data) is loaded and once lvar/hvars have been received,

Posted

Thank you again,

I've tried a couple of methods (e.g. event.control(67209,"StartLVars")  --PANEL_LIGHTS_POWER_SETTING_SET or event.control(67213,"StartLVars") ELECTRICAL_EXECUTE_PROCEDURE) as they are executed after loading the aircraft - didn't work.

Can you advise me of a method of executing an Lua function() after the LVars, HVars and Input events are loaded? If I'm on the ground or it's a specific aircraft, I will execute the code I want (I know how to determine ground and aircraft).

Posted
11 minutes ago, DaveSCUSA said:

I've tried a couple of methods (e.g. event.control(67209,"StartLVars")  --PANEL_LIGHTS_POWER_SETTING_SET or event.control(67213,"StartLVars") ELECTRICAL_EXECUTE_PROCEDURE) as they are executed after loading the aircraft - didn't work.

Sorry, but what do you mean by 'didn't work'? Wasn't your handling function called when the event was sent? If not, please show me your logs and ini files.

13 minutes ago, DaveSCUSA said:

Can you advise me of a method of executing an Lua function() after the LVars, HVars and Input events are loaded?

Why not use the [Auto] section? Lua autos are ran once the initial lvar/hvar list has been received by FSUIPC7. That is the whole purpose of the [Auto] section. See the section Automatic running of Macros or Lua plugins in the Advanced User guide.

There is no event or offset change when Input Events are received, but these are requested once the initial lvars have been received and should be available shortly afterwards.

John

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.