• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Yet another XML coding question

Messages
1,564
Country
thailand
Bloody hard to remember the rules when it comes to this part of XML ...

Based on the value of an L:Var, I want to initiate one of four events in a mouse click.

(L:TestVar, enum) can be 0, 1, 2, or 3

If 0, I want, in essence, <Click> (>K:COM1_RADIO_WHOLE_INC) </Click>
If 1, <Click> (>K:COM2_RADIO_WHOLE_INC) </Click>
If 2, <Click> (>K:NAV1_RADIO_WHOLE_INC) </Click>
If 3, <Click> (>K:NAV2_RADIO_WHOLE_INC) </Click>

I'm playing around with a radio that has one tuning knob only, but can tune different radios depending on the L:TestVar number. Seems I should be able to do this in one <Click> line using {case} but I haven't gotten it right yet.

Additionally, I tried {Case} is a string construction with <Click Event="{Case} code goes here" /> also without luck.

How to do?

Wiki time!

Bob
 
Bob,

Have you tried this? Of course not tested..

EDIT - TESTED, IT DOES NOT WORK, Thanks Taguilo ;)

Code:
<Click>(>K:NAV2_RADIO_WHOLE_INC) (>K:NAV1_RADIO_WHOLE_INC) (>K:COM2_RADIO_WHOLE_INC) (>K:COM1_RADIO_WHOLE_INC) 4 (L:TestVar, number) case</Click>
 
Last edited:
Don't know, I always use 4 IF lines...

(L:TestVar, enum) 0 == if{ (>K:COM1_RADIO_WHOLE_INC) }
etc.
 
Bob,

Have you tried this? Of course not tested..

Code:
<Click>(>K:NAV2_RADIO_WHOLE_INC) (>K:NAV1_RADIO_WHOLE_INC) (>K:COM2_RADIO_WHOLE_INC) (>K:COM1_RADIO_WHOLE_INC) 4 (L:TestVar, number) case</Click>

No way. What you are doing is putting those events in the stack hence incrementing the 4 radios at the same time.

Not much to shorten here appart from typical:

<Click>
(L:TestVar, number) sp0
l0 0 == if{ Event1 or @macro(Radio1) }
l0 1 == if{ Event2 or @macro(Radio2) }
...
etc
</Click>



Tom
 
Or even more verbose - Tom G. example WILL work. As will this and allow multiple tooltips if wanted,,, but it is UGLY. o_O

Code:
<Mouse>
<Area Name="COMM1 WHOLE UP" Left="X" Top="Y" Width="X" Height="Y">
<Visible>(L:TestVar, number) 0 ==</Visible>
<Cursor Type="UpArrow"/>
<Click>(>K:COM1_RADIO_WHOLE_INC)</Click>
</Area>

<Area Name="COMM2 WHOLE UP" Left="Same X" Top="Same Y" Width="Same X" Height="Same Y">
<Visible>(L:TestVar, number) 1 ==</Visible>
<Cursor Type="UpArrow"/>
<Click>(>K:COM2_RADIO_WHOLE_INC)</Click>
</Area>

<Area Name="NAV1 WHOLE UP" Left="Same X" Top="Same Y" Width="Same X" Height="Same Y">
<Visible>(L:TestVar, number) 2 ==</Visible>
<Cursor Type="UpArrow"/>
<Click>(>K:NAV1_RADIO_WHOLE_INC)</Click>
</Area>

<Area Name="NAV2 WHOLE UP" Left="Same X" Top="Same Y" Width="Same X" Height="Same Y">
<Visible>(L:TestVar, number) 3 ==</Visible>
<Cursor Type="UpArrow"/>
<Click>(>K:NAV2_RADIO_WHOLE_INC)</Click>
</Area>
</Mouse>
 
Thanks, all. Yeah, I was able to get it to work in one <Click> line with 4 if{ (>K:Event) } which was actually the first thing I tried. But, I got it into my head that I should be able to use {case}, which went nowhere as you all advise. I tried the way Roman first suggested ... no luck of course. I experienced what Tom says ... all radios incremented regardless of the L:Var number.

So, in this case, I will throw out the {case} approach and not try to get too cute with it.

Many, many thanks!!

Bob
 
Back
Top