Sign in to follow this  
spokes2112

FSX XML: Nested Case Statements Possible?

Recommended Posts

I have a series of "Signs" that need to be displayed next to a "soft-select button." Which is displayed depends on exactly one of five combinations of conditions.Here are the "sign bitmaps":EHSI_Sign_VOR.bmp // A:GPS drives nav1 = 0EHSI_Sign_LOC.bmp // above + NAV1 is LOCEHSI_Sign_DME.bmp // above + NAV1 has DMEEHSI_Sign_ILS.bmp // above + NAV1 has LOC + GS (ILS)EHSI_Sign_GPS.bmp // A:GPS drives nav1 = 1The VOR and GPS are easy:14.000,68.0000.0001.0000.000TrueTrue1.000TrueTrueDoes anyone have any possible solution for the VOR "alternate" bitmaps? I've tried "nested statements and that simply doesn't display at all. The gauge draws, but the first 0.000 simply disappears...

Share this post


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

Could do something like this?Above the element above have 3 elements that do logic with if{}'s:(In psydo code) (L:SignLoc, bool) = A:GPS drives nav1 AND NAV1 is LOC (L:SignDme, bool) = A:GPS drives nav1 AND NAV1 has DME L:SignILS = A:GPS drives nav1 AND NAV1 has LOC + GS (ILS)or..........How about nested if{}'s to do the logic finishing with a case{}?Sorry I'm not setup to do XML right now, or I'd have tried to give you more specific code.Patrick

Share this post


Link to post
Share on other sites

It's just as well that I took a hiatus from XML about four years ago. Now I'm not handicapped with ingrained "habits" from the FS9 syntax! ;)Unless something else comes up, I'll probably wimp out and simply set up a seperate structure to accomodate the Approach Flags, and add a condition to "hide" the VOR/GPS flags whenever the Approach set is active.I'm about 95% code complete with this version. Since I have the C version opened on my right monitor, I can quickly find the precise coordinates used and enter them in the XML file on the left monitor, while "seeing" the working gauge in FSX on the center monitor. ;)After I finish the code and debug phase, I'll go back through a fresh copy and replace all the bitmaps with vector drawn replacements.

Share this post


Link to post
Share on other sites

Nice setup. One of the fringe benefits of making good stuff I guess. =)Patrick

Share this post


Link to post
Share on other sites

Hi,In fs9 you could make something like:....(A:GPS DRIVES NAV1,bool) if{ 1 (>L:var,enum) } els{ (A:NAV1 HAS NAV,bool) (A:NAV1 HAS DME,bool) ! (A:NAV1 HAS LOCALIZER,bool) ! and and if{ 2 (>L:var,enum) } (A:NAV1 HAS DME,bool) (A:NAV1 HAS LOCALIZER,bool) ! and if{ 3 (>L:var,enum) } (A:NAV1 HAS LOCALIZER,bool) (A:NAV1 HAS GLIDE SLOPE,bool) ! and if{ 4 (>L:var,enum) } (A:NAV1 HAS LOCALIZER,bool) (A:NAV1 HAS GLIDE SLOPE,bool) and if{ 5 (>L:var,enum) } } (L:var,enum)....Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Brilliant, Jan! That should be simple enough to "translate" into FSX XML syntax...Now, why didn't I think of such an elegant, yet simple solution? *:-* Thanks! :-beerchug

Share this post


Link to post
Share on other sites

After adding one more check, it works a treat. I need the "VOR" flag to display by default if NAV mode is selected, but no signals are present at all. It was a simple matter to add to "case 2" :)Here is the FSX syntaxed version, in case anyone else needs to see how it's structured: 14.000,68.0001.0005.0001.000TrueTrue2.000TrueTrue3.000TrueTrue4.000TrueTrue5.000TrueTrue

Share this post


Link to post
Share on other sites

>>It's just as well that I took a hiatus from XML about four years >>ago. Now I'm not handicapped with ingrained "habits" from the FS9 >>syntax! :-lol :-lol :-lol :-lol :-lol :-lol :-lol :-lol :-lol :-lol :-lol :-lol :-lolAhh the good ol days of reverse Pollack "whatever". The irony is.. I be handicapped, and a Pollack !!!! But anyway, you've become a master at C which was most likely worth dropping the old XML ( I remember the trials you had with it back then. :-) ). Shoot I tried Dai's manuals from FS02 and on, "learn C in 24 hours", "You too can become a programmer in 5 minutes" etc.... Didn't work. Now... the xml has changed and time to learn over again. Oh well.Glad you found the solution. ( later reply ) Just better off havin a good vodka, sauerbraten, spatzel, pickled red cabbage and a good ol flight on FS than to batter the brain. :-lolhave a excellent weekend,PEACE!Regards,Roman

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