Jump to content
Sign in to follow this  
Guest iagman

Does XML do nested else-if statements?

Recommended Posts

Guest iagman

The following is the logic I need inside one mouse area:If VarA = 0 and VarB = 0, then set VarA = 1 and VarB = 1,else if VarA = 1 and VarB = 1, then set VarA = 0 and VarB = 0,else if VarA = 1 and VarB = 0, then set VarB = 1.One of the three statements will always be true.The following is my XML attempt to follow the above logic:(L:VarA, bool) ! ; (L:VarB, bool) ! ; &&if{ 1 (>L:VarA, bool) ; 1 (>L:VarB, bool) }els{ (L:VarA, bool) != ; (L:VarB, bool) != ; &&if{ 0 (>L:VarA, bool) ; 0 (>L:VarB, bool) } }els{ (L:VarA, bool) != ; (L:VarB, bool) ! ; &&if{ 1 (>LVarB, bool) } }The first level works, ie, when A and B both equal zero, they get reset to one. After that, nothing works.If the nested statements are not permissible, what about this:if VarA = 0 and VarB = 0, then set VarA = 1 and VarB = 1, goto g0if VarA = 1 and VarB = 1, then set VarA = 0 and VarB = 0, goto g0if VarA = 1 and VarB = 0, then set VarB = 1Once a true statement is found, then the goto jumps the remainingstatements to prevent them from being acted upon. Any comments appreciated.Glenn

Share this post


Link to post
Share on other sites

Hi,Try (not tested):(L:VarA, bool) ! (L:VarB, bool) ! and if{ 1 (>L:VarA, bool) 1 (>L:VarB, bool) } els{ (L:VarA, bool) (L:VarB, bool) and if{ 0 (>L:VarA, bool) 0 (>L:VarB, bool) } els{ (L:VarA, bool) (L:VarB, bool) ! and if{ 1 (>LVarB, bool) } } } Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest iagman

All three levels now work great. Thanks so much.One of the problems I have learning XML is spaces. The presence (or lack) of a space is not alway clear when reading code because different font types show spaces in varying width. Because space requirements are so exact in XML, I think having a visiblecharacter (~, maybe) instead of a space would make code easier to learn.Glenn

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