Jump to content
Sign in to follow this  
Guest bartels

XML question?

Recommended Posts

Guest mitch19542004

Can anyone tell me why this is not working. (A:ELEVATOR TRIM INDICATOR,degrees) 5 == I know the syntax for the bitmaps and position and stuff are right. For some reason the "==" operator does not seem to be working. HEEEEELLLLLLLLPPPPP!!!!!!!!!!!!!Mitch

Share this post


Link to post
Share on other sites
Guest bartels

I assume that you get exactly five degrees very rarely. Even 4.99999999 is truncated to 4. Use "near" for proper rouding before checking equality, or use a range around 5 degrees.(A:ELEVATOR TRIM INDICATOR,degrees) near 5 ==or(A:ELEVATOR TRIM INDICATOR,degrees) d 5.2 < r 4.8 > &&Arne Bartels

Share this post


Link to post
Share on other sites
Guest mitch19542004

That was dead on, thanks Arne. Where did you learn XML? I have your Tutorial, but as you know that is very limited. Is there another source that I can get a hold off?Thanks again.Mitch

Share this post


Link to post
Share on other sites
Guest bartels

I didn't learn XML at all, I just had a look at the default XML-gauges in FS002 an worked on. A lot of trial and error.I admittedly did know the general structure (visual part, mouse areas, variables, etc.) of gauges from programming C gauges for about six years or so.Actually the general XML structure is really straightforward and you can't "learn" it in my opinion. Have one look one it and you'll know the system. It helped me to know HTML structure beforehand. XML for gauges is another thing, all I wanted to achieve with my document (which isn't a tutorial!), was to help a bit over the first obstacles the avarage reader could experience. I didn't focus too much on the general structure of XML. I wrote down the things not easily understandable, e.g. the strange RPN usage (and what I was able to understand of course). So not a step by step turorial.To the special case of floats and equality: this is a problem you'll encounter on an almost daily basis in at any floating point operation in C/C++ and also XML for gauges (and possibly more languages). I could go in details, but just remeber NEVER check floats on equality, round first or use tolerance margins.Arne Bartels

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...