Jump to content
The simFlight Network Forums

event.Lvar would be really nice to have


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.