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

FSX 2d gauge formatting help

Messages
260
Country
germany
Ok, first time that I deal with images in a 2d gauge, and obviously I'm somewhat on the wrong track with this one.
I'm working on a loadout manager and I want to give a little graphical feedback to the user about fuel level in the varous tanks.
The below code only works at exactly the defined expression results but displays nothing inbetween, it displays an image at exactly 20, 40, 60, 80 and 100% but nothing at for instance 65%.
What am I doing wrong?


Code:
      <Element id="display center 1 tank">
            <FloatPosition>156.000,135.000</FloatPosition>
            <Select id="Select">
                <Expression id="Expression">
                    <Script>(A:FUEL TANK CENTER LEVEL,percent)</Script>
                </Expression>
                <Case id="Case 0">
                    <ExpressionResult>0</ExpressionResult>
                    <Image id="empty.bmp" Name="empty.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 20">
                    <ExpressionResult>20</ExpressionResult>
                    <Image id="center1_20.bmp" Name="center1_20.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 40">
                    <ExpressionResult>40</ExpressionResult>
                    <Image id="center1_40.bmp" Name="center1_40.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 60">
                    <ExpressionResult>60</ExpressionResult>
                    <Image id="center1_60.bmp" Name="center1_60.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 80">
                    <ExpressionResult>80</ExpressionResult>
                    <Image id="center1_80.bmp" Name="center1_80.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 100">
                    <ExpressionResult>100</ExpressionResult>
                    <Image id="center1_100.bmp" Name="center1_100.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
            </Select>
        </Element>
 
Ok, this seems to work good enough for what I want it to do:

Code:
<Element id="display center 1 tank">
            <FloatPosition>156.000,135.000</FloatPosition>
            <Select id="Select">
                <Expression id="Expression">
                    <Script>(A:FUEL TANK CENTER LEVEL,percent) 20 / near 2 *</Script>
                </Expression>
                <Case id="Case 0">
                    <ExpressionResult>0</ExpressionResult>
                    <Image id="empty.bmp" Name="empty.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 20">
                    <ExpressionResult>2</ExpressionResult>
                    <Image id="center1_20.bmp" Name="center1_20.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 40">
                    <ExpressionResult>4</ExpressionResult>
                    <Image id="center1_40.bmp" Name="center1_40.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 60">
                    <ExpressionResult>6</ExpressionResult>
                    <Image id="center1_60.bmp" Name="center1_60.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 80">
                    <ExpressionResult>8</ExpressionResult>
                    <Image id="center1_80.bmp" Name="center1_80.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case 100">
                    <ExpressionResult>10</ExpressionResult>
                    <Image id="center1_100.bmp" Name="center1_100.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
            </Select>
        </Element>
 
I was going to suggest using a "slider" and "mask" rather than a set of fixed graphics, so that it would be fully dynamic...

...but, if you're satisfied... :D
 
My problem is that I'm still recovering from the catatrophic loss of my ancient "development computer" where all of my previous examples and associated artwork were stored...

...I know that I've a very simple example at Free Flight Design, but I've not been able to log in there for months now so I can't provide a link.

Here is an example of a "strip tape" and "strip mask" being used for a speed tape type readout.

The "mask" is nothing more than a bitmap filled with RGB 1,1,1 (almost pure black). This is a "window" on which the current part of the speed tape image is allowed to be visible. Outside of this "window" the speed tape image is invisible.

The <Shift> part of the script controls the direction of the speed tape's movement as well as the scale of the movement.

<Axis>0.000,72.000</Axis> means the <Shift> is using the Y (up/down) axis.

<Scale>0.000,1.732</Scale> means the amount of movement on the Y axis to "calibrate" the speed tape's digital scale.

<Minimum>0.000</Minimum>
<Maximum>400.000</Maximum> these two entries define the min and max values for the speed tape. In your case you would likely want a max of 100 (for percent).


Code:
            <Element id="Speed Tape">
                <FloatPosition>8.000,44.000</FloatPosition>
                <Image id="pfd_speed_strip.bmp" Name="pfd_speed_strip.bmp">
                    <Transparent>True</Transparent>
                    <Axis>0.000,704.000</Axis>
                    <Bright>True</Bright>
                </Image>
                <MaskImage id="pfd_speed_strip_mask.bmp" Name="pfd_speed_strip_mask.bmp">
                    <Axis>0.000,72.000</Axis>
                </MaskImage>
                <Shift id="Shift">
                    <Scale>0.000,1.732</Scale>
                    <Expression id="Expression">
                        <Minimum>0.000</Minimum>
                        <Maximum>400.000</Maximum>
                        <Script>(A:Airspeed select indicated or true, knots)</Script>
                    </Expression>
                    <FailureTable id="FailureTable">
                        <Failure id="Failure">
                            <Fail_Key>SYSTEM_ELECTRICAL_PANELS</Fail_Key>
                            <Fail_Action>Zero</Fail_Action>
                        </Failure>
                    </FailureTable>
                </Shift>
            </Element>
 

Attachments

  • pfd_speed_strip_mask.jpg
    pfd_speed_strip_mask.jpg
    12.9 KB · Views: 439
  • pfd_speed_strip.jpg
    pfd_speed_strip.jpg
    32.7 KB · Views: 403
Last edited:
Ahhh, thanks much Bill, that looks a lot more convincing and streamlined!
I'll play with that, thanks!
 
Back
Top