• 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.

A simple gauge I thought!

Messages
1,084
Country
us-northcarolina
I have been trying to learn how to really program a simple xml gauge, not just modify somebody's which i actually can't find one that does not use click events. So far after four hours of write, copy to gauges, open the aircraft, find it doesn't work........I need help, PLEASE!!!

Here is what I have written. All I want to do is mouse click to turn on and off this dummy switch which I can then modify to make four other dummy switch lights on the panel which has three other working switches to open doors and lower a ramp. I can DO that cause they use key codes and/or click events like "wingfold" or "tailhook".

<Gauge Name="ramppower" Version="1.0">
<Image Name="pwroff.bmp"/>

<Element>
<Select>
<Value>(G:Var1)</Value>

<Case>
<Case Value="1">
<Image Name="pwravail.bmp"/>
<Position X="0" Y="0"/>
</Case>
</Select>
</Element>

<Mouse>
<Cursor Type="Hand"/>
<Click>(G:Var1)!(&gt;G:Var1)</Click>

</Gauge>

Can anyone please tell me what is wrong and rewrite it for me. I can follow example but I am beginning to feel like I just can't grasp this.

Thank you
 
Try

<Click>(G:Var1) ! (&gt;G:Var1)</Click>

There's a lot of places where spaces matter to XML.

Doug
 
Tried that but...

thank you Doug for taking the time, but just the space didn't work. The gauge still would not appear in FS9 in the aircraft panel though it shows in FSPS.W

hile I was waiting for a reply impatiently looked thru the FS9 gauges I have and I found a gauge for a dummy switch that I modified as below and that IS working with just one glitch you can help with I am sure. Here is the code:

<Gauge Name="ramppower" Version="1.0">
<Element>
<Select>
<Value>(L:ramppower, enum)</Value>
<Case Value="0">
<Image Name="pwroff.bmp" ImageSizes="32,40,0,0"/>
</Case>
<Case Value="1">
<Image Name="pwravail.bmp" ImageSizes="32,40,0,0"/>
</Case>
</Select>
</Element>
<Mouse>
<Tooltip ID="">Non-Functioning</Tooltip>
<Area Right="30">
<Cursor Type="DownArrow"/>
<Click>(L:ramppower, enum) -1 != if{ (L:ramppower, enum) 1 - (>L:ramppower, enum) }</Click>
</Area>
<Area Left="30">
<Cursor Type="UpArrow"/>
<Click>(L:ramppower, enum) 1 != if{ (L:ramppower, enum) 1 + (> L:ramppower, enum) }</Click>
</Area>
</Mouse>
</Gauge>

The glitch IS: if you click the "-" twice instead of once to turn off the switch the bmp totally disappears. I KNOW what happened, but i want to share this gauge with my vA and they may not "readme" and wonder what happened, besides this is the first gauge I am sharing with anyone and I (vainly) don't want to look stupid I want it to work perfectly. Please help again when you have a chance.

Thanks, Richard
 
With Doug's suggestion about spaces, simply adding the missing </Mouse> tag would have fixed your first example...

And please, use the # icon to wrap your code/script examples with the forum's
Code:
 tags!

[CODE]
<Gauge Name="ramppower" Version="1.0">
   <Image Name="pwroff.bmp"/>

   <Element>
        <Select>
            <Value>(G:Var1)</Value>
            <Case>
                  <Case Value="1">
                  <Image Name="pwravail.bmp"/>
                  <Position X="0" Y="0"/>
            </Case>
        </Select>
    </Element>

    <Mouse>
         <Cursor Type="Hand"/>
         <Click>(G:Var1)!(&gt;G:Var1)</Click>
    </Mouse>
</Gauge>
 
Last edited:
thanks n4gix for your help. Is there a way to click the -1 and +1 in the second gauge code only once each back and forth. What I mean is click off, click on, click off etc not click off click off in a row. Clicking on on doesnt do anything detrimental like off off takes away the off bmp.
 
thanks n4gix for your help. Is there a way to click the -1 and +1 in the second gauge code only once each back and forth. What I mean is click off, click on, click off etc not click off click off in a row. Clicking on on doesnt do anything detrimental like off off takes away the off bmp.

All you need, for both click areas, is this:

<Click>(L:ramppower, enum) ! (>L:ramppower, enum) }</Click>

This will limit the values to 0 and 1. Alternatively, the test for increasing the value is "less than 1" while the test for decreasing is "greater than zero"

Doug
 
thank you

thanks for the limiter code. last question

In order to open the ramp to airdrop height I need to "press" SHIFT+E+2 by the button. There is a click event for toggle exit but not for exit#2.

How would this be notated for the above:

I tried the code below copied from the main exit but it does not work.

<Gauge Name="airdropramp" Version="1.0">

<Image Name="transparent.bmp"/>

<Mouse>

<Click Event="TOGGLE_AIRCRAFT_EXIT_2"/>
<Cursor Type="Hand"/>
</Mouse>
</Gauge>

Again thanks.
 
I ask again, please wrap your script examples in the
Code:
 tags. It makes it SO much easier to read...

The information is in the FS SDK:

[B]TOGGLE_AIRCRAFT_EXIT [/B]
[I]Toggles primary door open/close. Follow by KEY_SELECT_2, etc for subsequent doors. [/I]

[CODE]
<Gauge Name="airdropramp" Version="1.0">
     <Image Name="transparent.bmp"/>

    <Mouse>
        <Click>
            (>K:TOGGLE_AIRCRAFT_EXIT)
            (>K:KEY_SELECT_2)
        </Click>
        <Cursor Type="Hand"/>
    </Mouse>
</Gauge>
 
Thanks again x 2.

This completes my panel and it works perfectly. I have used Click Event for the Talihook and wingfold commands from the list from FS2K and it is now fully functioning and complete with Tooltips and all.

Now I can go back to logging some flight hours after a weeks work on this C-17 ramp panel.

I didn't understand what you meant about the code wrap or I would have done it, sorry. I just used copy and paste.
 
I didn't understand what you meant about the code wrap or I would have done it, sorry. I just used copy and paste.

Look at the forums' toolbar. In the second row, third from the right is a # symbol.

Highlight the code or script sample and click on that icon to insert the
Code:
 tags.

Alternatively, click the icon before copy/pasting your code or script. Either way will work...

For that matter, you could even type the tags in manually... :rotfl:

[code]
     your script goes in here
[/ code]

[I]Note that I left a blank space in the closing tag so you could see it here.[/I]
 
Last edited:
Back
Top