Sign in to follow this  
rcbarend

IMPORTANT for all gauge designers ......

Recommended Posts

Hi all,Maybe this has been delt with before (but with so many new gauge designers it's good to repeat it), or maybe it sounds trivial to the experts, but DO realise the following when coding an (XML) gauge. I have seen several gauges (including one of myself :-( ) where, given a certain condition, a gauge continuously gives events to force a certain FS variable into a certain state, even if the variable is allready in that state.Example:Suppose you want a gauge to force the smoke On when the aircraft is in the air, and Off when on the ground (not very usefull, but it's just an example :-) )You could either code that as:1.(A:SIM ON GROUND)if{ (>K:SMOKE_OFF) } els{ (>K:SMOKE_ON) }or2.(A:SIM ON GROUND)if{ (A:SMOKE,bool) if{ (>SMOKE_TOGGLE) }}els{ (A:SMOKE,bool) ! if{ (>SMOKE_TOGGLE) }}Allthough they both set the smoke On or Off, the effect in FS is very different !!!In Method-1, the SMokeOn or SmokeOff event is continuously given, which is very WRONG !Why ?Have you ever had a aircraft where the following wasn't working:- Select Engine-2 ("E" followed by a "2")- Select Exit-2 ("Shift-E" followed by "2")- Pushback Right ("Shift-P" followed by "2")The major cause for this is, if the panel contains a gauge working according to method-1.Because FS never relates the "2" to the previous keystroke if the gauge gives an event in between the two keystrokes. Which is very likely if the gauge runs at an update rate of 500 msec or less.Note: the default update rate of an XML gauge is 55 msec.The lesson: always test the variable state to see whether giving the releated event is really necessary !!Of course, you are forced to do that when a variable only has Toggle events, but a lot of FS variables have both a ON OFF and TOGGLE event.I also realise that this is sometimes difficult to avoid, especially when you are controlling an axis from your gauge (like the throttle axis). Because it ALSO applies to _SET events.Just be aware of this effect when creating a gauge !!!Rob BarendregtPS. Of course, I'll never exclude the possibility that I'm wrong here, but I've just done a lot of tests and everytime they confirmed the conclusion above.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I use two workarounds for this. One is to include an axis_SET command within a limiter, so that it is not executed continously, but at given time intervals. Then the keyboard select events should work, since they would most likely happen within the new timespan. The other is to supply clickspots for these select commands if you suspect this can become a problem. I have modified the dc3 so that the turn indicator contains three clickspots; select left, right and both engines. In my setup this gauge is visible from most normal flying views. The doors are normally not a problem, since you can exclude _SET commands by checking against onground and aircraftvelocity parameters. If you do have to open doors in mid-flight, create the needed clickspot.As for toggle events, this problem become pretty obvious to most when tested. I try to avoid toggles and use on off commands instead. In most cases I believe you can create your own macros to perform on off (or set) commands for those toggles that can be checked against needed variables.

Share this post


Link to post
Share on other sites

Hi Karl,Thanks for the addition.You are obviously not a person my post was intended for :-)But since I saw a few downloads recently that have this problem, not every gauge designer is aware of this.And once you do, the solution usually is very simpel.Regards, Rob

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
Sign in to follow this