Jump to content
Sign in to follow this  
Varmint007

FS9 XML - if __ || __ then this els this

Recommended Posts

Guest Charlie Chan

I am trying to reverse the travel of the pitch indicator when the aircraft is upside-down. Here is the last code I tried. It parses but does not work in FS9. I am obviously a newbie at this. Will someone please help me solve this problem. The 'plane' in lower case is to remove the smiley face from the post.if{ (((A:plane BANK DEGREES, degrees) > 90 ) || ((A:plane BANK DEGREES, degrees) < -90)) ((A:A:Attitude indicator pitch degrees, degrees) /-/)} els {(A:Attitude indicator pitch degrees, degrees)}

Share this post


Link to post
Share on other sites
Guest Slacktide

>I am trying to reverse the travel of the pitch indicator when>the aircraft is upside-down. Here is the last code I tried. >It parses but does not work in FS9. I am obviously a newbie>at this. Will someone please help me solve this problem. The>'plane' in lower case is to remove the smiley face from the>post.>>if{ (((A:plane BANK DEGREES,>degrees) > 90 ) ||> ((A:plane BANK DEGREES, degrees) < -90))> ((A:A:Attitude indicator pitch degrees, degrees) /-/)}> els {(A:Attitude indicator pitch degrees, degrees)}>First off, you're using the if statement incorrectly. The correct syntax is:logical_test if{ do_this_stuff_if_logical_test_is_true } els{ do_this_stuff_if_logical_test_is_false }Second, you've got A:A:Attitude... in the fourth line, should be just A:Attitude...Also, take a look at your els statement. it should be els{ stuff }, not els {stuff}. The location of the spaces is critical.Dan

Share this post


Link to post
Share on other sites
Guest Slacktide

One other thing, all mathematics must be in postfix notation. Instead of `A || B`, you need to use 'A B ||'

Share this post


Link to post
Share on other sites
Guest Charlie Chan

Thank you for the response! Please forgive an old mans ignorance of the language. Is this how it should be written?(((A:plane bank degrees, degrees) > 90 )((A:plane bank degrees, degrees) < -90) ||) if{((A:Attitude indicator pitch degrees, degrees) /-/)}els{(A:Attitude indicator pitch degrees, degrees)}

Share this post


Link to post
Share on other sites

(((A:plane bank degrees, degrees) > 90 )((A:plane bank degrees, degrees) < -90) ||) if{((A:Attitude indicator pitch degrees, degrees) /-/)}els{(A:Attitude indicator pitch degrees, degrees)} 1) you must use postfix notation, so it's not > 90, it's 90 >.2) you do not need the extra parens unless you're doing inline calculations within a string. So instead of (((A:plane bank degrees, degrees) > 90 ). Use: (A:plane bank degrees, degrees) > 903) You cannot use "<" in XML for any version of FS, as it will be interpreted as HTML. Use "<" instead. Although not necessary in FS9, you should also use ">" for ">", and && for "and"4) As mentioned before, spacing within logic structures is critical.You used "els{(A:Attitude indicator pitch degrees, degrees)} ", It MUST be written as "els{" with no space between "els" and "{". and then a space after "{" and before your statement.(A:plane bank degrees, degrees) 90 > (A:plane bank degrees, degrees) -90 < || if{ (A:Attitude indicator pitch degrees, degrees) /-/ } els{ (A:Attitude indicator pitch degrees, degrees) } --Jon

Share this post


Link to post
Share on other sites
Guest Charlie Chan

Thank you the code help!! However, after testing the gauge, I discovered that it only works correctly approximatly 60 percent of the time. I am trying to better define the conditions under which the pitch would be negated in hopes that this will solve the problem. I want to define the range for the negative bank reading as less than a negative 90 degrees and greater than or equal to -180 degrees. For the positive bank reading as greater than 90 degrees and less than or equal to 180 degrees. I have found out the hard way that XML does not allow a &, &&, or And. I have been unable to write the desired code in an acceptable manner. Here is some of what I have tried: ( (A:Plane bank degrees, degrees) -90 < -180 >= ) ( (A:Plane bank degrees, degrees) 90 > 180 <= ) || if{ (A:Attitude indicator pitch degrees, degrees) /-/ } els{ (A:Attitude indicator pitch degrees, degrees) }========================================== ( (A:Plane bank degrees, degrees) -90 < (A:Plane bank degrees, degrees) -180 >= ) ( (A:Plane bank degrees, degrees) 90 > (A:Plane bank degrees, degrees) 180 <= ) || if{ (A:Attitude indicator pitch degree, degrees) /-/ } els{ (A:Attitude indicator pitch degrees, degrees) }========================================== ( ( (A:Plane bank degrees, degrees) -90 <) ( (A:Plane bank degrees, degrees) -180 >= ) ) ( ( (A:Plane bank degrees, degrees) 90 > ) ( (A:Plane bank degrees, degrees) 180 <= ) ) || if{ (A:Attitude indicator pitch degrees, degrees) /-/ } els{ (A:Attitude indicator pitch degrees, degrees) }Do to some formatting problems, their appearance in the forum is not the same as in the XML file. Would some one please help with this.

Share this post


Link to post
Share on other sites
Guest Charlie Chan

I have finally solved the problem. Much thanks to Varminit007 for his help in doing so. Here is the code that I used. If any one wants to see the complete code and some screen shots of what I have been doing then go to cfcforums.com and their Panel and Gauge Design forum. It is a unique gauge set in what I call a Flight Reference Panel. I do not know if the FAA would approve of the attitude indicate but I like it. (A:Attitude indicator bank degrees, degrees) 90 > (A:Attitude indicator bank degrees, degrees) 180 <= && (A:Attitude indicator bank degrees, degrees) -90 < (A:Attitude indicator bank degrees, degrees) -180 >= && || if{ (A:Attitude indicator pitch degrees, degrees) /-/ } els{ (A:Attitude indicator pitch degrees, degrees) }

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