Jump to content
The simFlight Network Forums
Emile B.

How to write Local Gauge variables automatically on loading aircraft ?

Recommended Posts

Using P3DV4.3 with FSUIPC V5.14 (UseProfiles=Files)
I am trying to set two Local Gauge Variables when the PMDG 737NG is loaded so that both pilots' yokes are lowered automatically on startup.  To this effect I added the following two lines to a lua plug-in, stored in the \Modules folder and called in the [Auto] section of the file 737NG.ini in the \Modules\Profiles folder :
ipc.writeLvar("L:yoke_left_hide", 1)
ipc.writeLvar("L:yoke_right_hide", 1)

Unfortunately it does not work and the yokes stubbornly remain up unless I lower them myself.  I'm obviously leaving something out.  How can I get these two commands to run automatically ?  Any help appreciated.

Thanks,
Emile.

Edited by Emile B.

Share this post


Link to post
Share on other sites

Are they known L:Vars? Do you know thay work? Test by assigning a keypress (temporarily perhaps) to that Lua file and use that first.

If they are proven to work, maybe they are sent too early, after the aircraft is seen to load but before the graphics are full drawn. You could try putting a delay in at the start (ipc.sleep).

How are they normally lowered? If that by a control?

Pete

 

Share this post


Link to post
Share on other sites
9 hours ago, Pete Dowson said:

Are they known L:Vars? Do you know thay work? Test by assigning a keypress (temporarily perhaps) to that Lua file and use that first.

If they are proven to work, maybe they are sent too early, after the aircraft is seen to load but before the graphics are full drawn. You could try putting a delay in at the start (ipc.sleep).

How are they normally lowered? If that by a control?

Pete

 

Hi Peter, that's a good point.  Yes they are existing LVars and I know that they worked in the FSX version of the PMDG 737NG.  Therefore I just assumed - possibly erroneously - that this would also apply in the P3D version.  I will first of all use your suggestion of a keypress to verify if the Lvar writes do indeed work but may be sent too soon, in which case a delay would fix the problem.
I would have to check if there is a control that lowers the yokes, as previously writing the Lvars did the trick.  Sure, a mouse click will lower them but that's a bit easy !
All in all, many thanks for your helpful suggestions.

Regards,
Emile.

Edited by Emile B.

Share this post


Link to post
Share on other sites
3 hours ago, Emile B. said:

Sure, a mouse click will lower them but that's a bit easy !

You can also use Mouse Macros.  They are quite good generally in P3D4, though currently there's a difficulty in that the programming for them doesn't stay constant. L-M are fixing that.

Pete

 

Share this post


Link to post
Share on other sites

Hi Peter, I have just established that the two Lvar writes do indeed work when I put them in a function and call that via a flag event.  So I will put an ipc.sleep in front of the two lines to delay their execution and see if they still work when inside the auto loaded lua plug-in but not inside a function.

Cheers,
Emile.

 

Share this post


Link to post
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

×

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.