FSXA A little help with gauge XML

#1
Hi folks,
I need some assistance please. I have a project of my own in FSXA and I need some help with the XML. Any assistance would be gratefully appreciated.

The problem, I have two identically sized gauges at the identical location on the same $gauge bitmap in the vc. I would like to control their respective visibilities with two corresponding buttons in the said vc.
Logic, when button 1 is pressed, gauge 1 appears, when button 2 is pressed, gauge 1 disappears and gauge 2 appears and vice versa. The code example is posted below. Can anybody point out the error in my ways please.

In the Modeldef
XML:
 <PartInfo>
    <Name>gauge1</Name>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <CallbackCode>
        (L:gauge1,enum) 1 ==
      </CallbackCode>
    </MouseRect>
  </PartInfo>


<PartInfo>
    <Name>gauge2</Name>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <CallbackCode>
        (L:gauge2,enum) 2 ==
      </CallbackCode>
    </MouseRect>
  </PartInfo>
The gauges-
Gauge1:
XML:
<?xml version="1.0" encoding="UTF-8"?>

<SimBase.Document
        Type="AceXML"
        version="1,0"
        id="data">
    <Descr>AceXML Document</Descr>
    <Filename>gauge1.xml</Filename>
    <SimGauge.Gauge id="Gauge" ArtDirectory="D:\FSX\SimObjects\Rotorcraft\heli_new_age\PANEL\gauge_disp1">
        <FloatPosition>0.000,0.000</FloatPosition>
            <Visibility>(L:gauge1,enum) 1 ==</Visibility>
        <Image id="gauge1.bmp" Name="gauge1.bmp">
            <Transparent>True</Transparent>
        </Image>
    </SimGauge.Gauge>
</SimBase.Document>
Gauge2:
XML:
<?xml version="1.0" encoding="UTF-8"?>

<SimBase.Document
        Type="AceXML"
        version="1,0"
        id="data">
    <Descr>AceXML Document</Descr>
    <Filename>gauge2.xml</Filename>
    <SimGauge.Gauge id="Gauge" ArtDirectory="D:\FSX\SimObjects\Rotorcraft\heli_new_age\PANEL\gauge_disp1">
        <FloatPosition>0.000,0.000</FloatPosition>
            <Visibility>(L:gauge2,enum) 2 ==</Visibility>
        <Image id="gauge2.bmp" Name="gauge2.bmp">
            <Transparent>True</Transparent>
        </Image>
    </SimGauge.Gauge>
</SimBase.Document>
Kind regards, TJ
 

tgibson

Resource contributor
#3
AFAIK you cannot swap gauges dynamically, so Heretic's approach would be best if true. You can then swap them out in gauge code. It appears that all you are doing is swapping two gauge BMP files, which is quite easy to do in a single gauge.

Here is an example based on the value of an L: variable:

Code:
<Element>
       <Position X="18" Y="45"/>
      <Select>
         <Value>(L:AF1, enum)</Value>
           <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="0"/>
           </Failures>
         <Case Value="1">
        <Image Name="WATER_LITE_ON.bmp" Bright="Yes" />
         </Case>
         <Case Value="0">
        <Image Name="WATER_LITE_OFF.bmp" Bright="NO" />
        </Case>
     </Select>
</Element>
 
#4
Thanks for the replies gents. What a downer, I was so hoping this could be done as the above was just examples to simplify what I wanted to achieve. The actual gauges are much larger and crash when I combine them. In that case, I might try a different approach and create to seperate gauge polys to do the same thing. Would you guys know how I could achieve that instead?
 
#5
Let me clarify my last post, since I cannot achieve what I wanted to, my aim now is to put identical gauge polys in the same position but call them into being visible on the click of the corresponding button. They would also disappear when the second button was pressed thus displaying the second poly and vice versa. I have tried using the L:var, enum approach above but it does not work. There is something wrong with my code. Any ideas?
Thanks in advance, TJ
 

Heretic

Resource contributor
#6
Each gauge poly requires a unique material and its own [VCockpitxx] entry in the panel.cfg, even if merely being a clone of another gauge poly.
Gauge poly visbility can then be controlled with visibility tags.
 
#7
I've done something similar in the past. Click on the magic screw and the VOR gauge turns into an ADF gauge.
All I did was make ONE gauge with both elements included.
 
#8
Yes Bjoern, you are absolutely right and that is what I am going to do, however, I am having trouble writing the visibility code to achieve this outcome. The code I am using in my modeldef is attached below but does nothing for me. What am I doing wrong?

XML:
 <PartInfo>
    <Name>gauge1</Name>
       <Visibility>
         <Parameter>
            <Code>
                (L:gauge1,enum) 1 ==
            </Code>
         </Parameter>
       </Visibility>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <CallbackCode>
        (L:gauge1,enum) 1 ==
      </CallbackCode>
    </MouseRect>
  </PartInfo>

 <PartInfo>
    <Name>gauge2</Name>
       <Visibility>
         <Parameter>
            <Code>
                (L:gauge1,enum) 2 ==
            </Code>
         </Parameter>
       </Visibility>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <CallbackCode>
        (L:gauge1,enum) 2 ==
      </CallbackCode>
    </MouseRect>
  </PartInfo>
Regards, TJ
 
#9
I've done something similar in the past. Click on the magic screw and the VOR gauge turns into an ADF gauge.
All I did was make ONE gauge with both elements included.
Chris I would love to do that but when I combine the two gauge codes, nothing shows up in the sim. Now my XML prowess certainly isn't of any high level and I have run the gauge through IE to try and spot the error but nothing shows up and I am just copying and pasting here and don't have the time or inclination to go through several thousand lines of code so am just thinking that I will now use the cheats way and try and make the polys appear and disappear when I click on their corresponding call button. Regards
 
#11
2 things..
Your callback code isn't doing anything.. It is comparing not assigning a value.
XML:
<!-- DOES NOTHING -->
<CallbackCode>
        (L:gauge1,enum) 2 ==
</CallbackCode>

<!-- CHANGE TO -->
<CallbackCode>
        2 (>L:gauge1,enum)
</CallbackCode>
Second - you may want to think deeper than just a single var for visibility ( and clicks too ) as there are 4 possible states to deal with.

OFF OFF
ON OFF
OFF ON
ON ON

A clue for this is to look at a key type ignition switch, such as in the stock 172 or Baron.
 
Top