Jump to content
The simFlight Network Forums

Variable value collection flow


Recommended Posts

Hi all,

I want to add two offsets to FSUIPC in order to save the value of two Q400 variable. These two offsets will be read by Spad.neXt.
So I wrote a LUA script that reads variables value (could be 0 or 255) and writes they to FSUIPC offset 66C0 and 66C3.
I need to read both variables continuously so I thought of writing a C# program that every 50ms would write to the 0x0D70 offset, and pass the Lua command with the name of my lua script. 
From what I understand when the 0x0D70 offset is written FSUIPC executes the indicated script via the indicated command, so I expect to have FSUIPC offset 66C0 and 66C3 filled every 50ms with the value of Q400's variables and ready for Spad.neXt.

Any comment/criticism/suggestion about this flow?

Cheers,

Alessandro

Link to comment
Share on other sites

It's very inefficient having a Lua plug-in loaded, compiled and executed repeatedly -- especially so often.

As John says, you can design you Lua plug in to operate at regular time intervals easily by using event.timer. You only have the plug-in loaded and compiled for you just the once that way -- loaded probably by an [Auto] section command.

Are these Q400 values obtained from L:Vars? If so then just use the event.Lvar function instead, one for each of the LVars you need to monitor.  The minimum monitor time there is currently set to 100 mSecs, not 50, but with two of them operating you might meet your 50 mSecs target.

Pete

 

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.