Sign in to follow this  
Guest iagman

Does XML do nested else-if statements?

Recommended Posts

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
Help AVSIM continue to serve you!
Please donate today!

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

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