Sign in to follow this  
n4gix

XML-Gauge nested case-statements

Recommended Posts

Hi,I'm quite new to XML-gauge programming and to XML at all.Based On what I found in MS- and 3rd-Party-Files I started doing gauges and it worked quite well. Only thing I really hate is this stack-thingy when constructing more complex conditional statements.I wonder if there is a way to do that like it was back the days of procedural C, when I was young and learnd things easiely ;-) Doing that, you end up with code looking like this:(A:Circuit general panel on, bool)(A:GENERAL ENG1 FUEL PRESSURE, psi) 10.00 > if{ 1 } els{ 0 }(A:GENERAL ENG1 FUEL PRESSURE, psi) 25.00 < if{ 1 } els{ 0 }not worth to mention that this is not working at all. Does anybody know if there is a way to do that, or do I have to learn new tricks as an old dog?best regards and thanks in advance for any reply.

Share this post


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

Hi,The syntax= (A:Circuit general panel on,bool)(A:GENERAL ENG1 FUEL PRESSURE,psi) 10.00 > if{ 1 } els{ 0 } some more: (A:Circuit general panel on,bool)(A:GENERAL ENG1 FUEL PRESSURE,psi) 10.00 < if{ 0 } (A:GENERAL ENG1 FUEL PRESSURE,psi) 10.00 > (A:GENERAL ENG1 FUEL PRESSURE,psi) 25.00 < and if{ 1 } (A:GENERAL ENG1 FUEL PRESSURE,psi) 25.00 > if{ 2 } or(A:Circuit general panel on,bool) if{ (A:GENERAL ENG1 FUEL PRESSURE,psi) 10.00 < if{ 0 } els{ (A:GENERAL ENG1 FUEL PRESSURE,psi) 10.00 > (A:GENERAL ENG1 FUEL PRESSURE,psi) 25.00 < and if{ 1 } els{ (A:GENERAL ENG1 FUEL PRESSURE,psi) 25.00 > if{ 2 } } } }or with s and l:(A:Circuit general panel on,bool) if{ (A:GENERAL ENG1 FUEL PRESSURE,psi) s0 10.00 < if{ 0 } els{ l0 10.00 > l0 25.00 < and if{ 1 } els{ l0 25.00 > if{ 2 } } } }Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi,If you only want a warning between 10 and 25 try:(A:Circuit general panel on,bool) if{ (A:GENERAL ENG1 FUEL PRESSURE,psi) s0 10.00 > l0 25.00 < and if{ 1 } }Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi Or (A:Circuit general panel on,bool) if{ 10 25 (A:GENERAL ENG1 FUEL PRESSURE,psi) rng if{ 1 } }

Share this post


Link to post
Share on other sites

Guys,Comparisons between two values (ie Value1 Value2 >= or Value1 Value2 == ; etc) always result in a boolean 0 if false or 1 if true, therefore it isn't necessary to use if{}/els{} operators to obtain the desired value. It is ok to code,for example, 10 25 (A:GENERAL ENG1 FUEL PRESSURE,psi) rngor(A:GENERAL ENG1 FUEL PRESSURE,psi) 25 >etc.Tom

Share this post


Link to post
Share on other sites

Hi,(A:Circuit general panel on,bool) 10 25 (A:GENERAL ENG1 OIL PRESSURE,psi) rng and Should work.Is the name of the bitmap ok?Mind the spaces. Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Thanks alot, now it's working!The bitmap name was not spelled okay, and some other "minor mistakes"I had a last hard time finding that 1 + 1 is 2 in the real world, but not when tinkering with bool-expressions, but now it does what it was expected to. ;-)

Share this post


Link to post
Share on other sites

>I had a last hard time finding that 1 + 1 is 2 in the real>world, but not when tinkering with bool-expressions, but now>it does what it was expected to. ;-)It's a matter of understanding what's happening, that's all... ;)(A:Circuit general panel on,bool) 10 25 (A:GENERAL ENG1 OIL PRESSURE,psi) rng and The first expression will only evaluate to either true or false: hence either 1 or 0.The second expression will only evaluate to true (1) IF the variable is within the range (rng) declared as 10 to 25psi, otherwise false (0)."and" means combine the two expression's results and return a value...Hence, the only possible outcomes:0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 2

Share this post


Link to post
Share on other sites

>It's a matter of understanding what's happening, that's all...>;)>"and" means combine the two expression's results and return a>value...>>Hence, the only possible outcomes:>>0 + 0 = 0>1 + 0 = 1>0 + 1 = 1>1 + 1 = 2Bill, you always amaze me! :-eek :-)Actually Value1Bool "and" Value2Bool returns True (1) if BOTH values are True otherwise it returns False (0). So,0 and 0 = 01 and 0 = 00 and 1 = 01 and 1 = 1Tom

Share this post


Link to post
Share on other sites

Hi,Actually Tom was right and i made an error.If more are wanted i use, here 4 (0-3):(L:first,bool) (L:second,number) 100 > if{ (L:third,bool) } 2 * + Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

>>It's a matter of understanding what's happening, that's>all...>>;)>>>"and" means combine the two expression's results and return>a>>value...>>>>Hence, the only possible outcomes:>>>>0 + 0 = 0>>1 + 0 = 1>>0 + 1 = 1>>1 + 1 = 2>>Bill, you always amaze me! :-eek :-)>>Actually Value1Bool "and" Value2Bool returns True (1) if BOTH>values are True otherwise it returns False (0). So,>>0 and 0 = 0>1 and 0 = 0>0 and 1 = 0>1 and 1 = 1Well, pobody's nerfect! ;)Actually, I had it right the first time, (mis)thought about it, then edited my original reply to make it wrong... *:-* Had the original "formula" been:(A:Circuit general panel on,bool)10 25 (A:GENERAL ENG1 OIL PRESSURE,psi) rng+though, my answer would have been entirely correct... ;)I think...

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