Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Dear Pete,

I kindly ask you, if a function event.Lvar(LvarName, interval, function name) could be implemented in a future release of FSUIPC. This event function should register a Lvar for tracking of changes. Whenever the Lvar changes, the named function should be triggered. The check interval should be configurable for performance reasons.

Why would this be useful? Today a lof of panels work with Lvars to expose states to the outside world. So typically this is fine for accessing them with LUA scripts. But as the pattern is always the same for all cockpit freaks, to react on these variables, it would be nice to have a generic implemention which could be called with one simple function call.

So what are we typically doing for every single Lvar at the moment:

We define a function, which we are calling by an event.timer. This function checks, if the state since the last call has changed for this Lvar. And if so: We are doing something. So a generic solution following this pattern, would be great.

Many things today could be solved by monitoring offsets, but a lot of more complex aircrafts (like the DA Fokker) often use their own logic to implement certain functionality. Then typically you might have the chance to react on the Lvars used. And at the moment you have to implement this mechanism for every Lvar you want to monitor.

By having one single event function to register the Lvar checking on a timer base would be a great reduction in code necessary to interface with cockpit hardware to such airplanes.

Just an idea and maybe my wish for this year's Xmas ;-)

Best regards

Reinhard

Posted

I kindly ask you, if a function event.Lvar(LvarName, interval, function name) could be implemented in a future release of FSUIPC. This event function should register a Lvar for tracking of changes. Whenever the Lvar changes, the named function should be triggered. The check interval should be configurable for performance reasons.

Hmmm. Interesting idea. I never implemented a normal event on LVar chages because of the performance problem when continuously reading them, but having a polling interval could solve that.

I'd like to impose a minimum interval though. What do you think would be the longest minimum which could be tolerated?

Regards

Pete

Posted

Hi,

In my code pieces I typically set the timer between 250 and 500 msec. That's normally enough and reduces load. A minimum could be set to 100 msec for example.

Rgds

Reinhard

Posted

In my code pieces I typically set the timer between 250 and 500 msec. That's normally enough and reduces load. A minimum could be set to 100 msec for example.

Okay. I thought 50 or 100 mSecs as a minimum. I'll see if I can add it before my upcoming August holidays.

Pete

Posted

Wow - if you rare eally able to do it so quickly, then Xmas is already in August this year :smile:

Just got it in before August ;-). download FSUIPC 4.841 or 3.999t as appropriate. The Lua documentation is also updated -- see its own thread in Download Links.

Regards

Pete

Posted

Hi,

Merry Xmas. It works perfectly !!!

I have just done a first test. I reduced my code and modified it to the new event.Lvar function. And immediately this did work.

Now your August vacation is near ;-)

Best regards

Reinhard

Posted

Merry Xmas. It works perfectly !!!

I have just done a first test. I reduced my code and modified it to the new event.Lvar function. And immediately this did work.

Good! Enjoy! ;-)

Pete

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.