• 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 Change size of element with variable

Messages
12
Country
belgium
Hello everybody, first post over here and I'll get a chance to thank you all for all the help and good lessons in my trial and error adventure.

I have been modifying the default G1000 to fit the design of the one I use.
I am stuck at the fuel gauge, though, and it may be an easy fix, but after 3 days I just can't seem to find it.
My problem is that I need to change the size of a vertical bar, according to the amount of fuel in each tank. The 0 is in the bottom (so the bar would be 0 pixels) and the max is 60 USGAL, which conveniently, would be 60 pixels high.

What I am trying to achieve is the right. What I have is the left.
wdLaY8i.png


This is the code I have so far (really like the one from the default) and I manage to move the "indicator tip" as needed with the shift function.

Code:
<Element id="Left indicator">
                        <FloatPosition>33.000,0.000</FloatPosition>
                         <Element id="White line">
                                <FloatPosition>0.000,0.000</FloatPosition>
                                <VerticalLine id="VerticalLine">
                                    <Bright>True</Bright>
                                    <Height>(A:FUEL LEFT QUANTITY, gallons)</Height>
                                    <LineColor>White</LineColor>
                                    <LineWidth>5</LineWidth>
                                </VerticalLine>
                            </Element>
                        <Shift id="Shift">
                            <Expression id="Expression">
                                <Script>(A:FUEL LEFT QUANTITY, gallons)</Script>
                            </Expression>
                            <NonlinearityTable id="NonlinearityTable">
                                <NonlinearityEntry id="60">
                                    <ExpressionResult>60.000</ExpressionResult>
                                    <FloatPosition>21.000,0.000</FloatPosition>
                                </NonlinearityEntry>   
                                <NonlinearityEntry id="0">
                                    <ExpressionResult>0.000</ExpressionResult>
                                    <FloatPosition>21.000,60.000</FloatPosition>
                                </NonlinearityEntry>                               
                            </NonlinearityTable>
                        </Shift>
                        <Element id="Indicator tip">
                            <FloatPosition>0.000,0.000</FloatPosition>
                            <Polygon id="Polygon">
                                <Bright>True</Bright>
                                <FillColor>White</FillColor>
                                <FillColorScript>@FuelQty1Caution if{ &apos;Yellow&apos; }
els{
    @FuelQty1Warning if{ &apos;Red&apos; }
    els{ &apos;White&apos; }
}</FillColorScript>
                                <LineWidth>1</LineWidth>
                                <LineColor>Black</LineColor>
                                <Point id="0, 0">
                                    <FloatPosition>0.000,0.000</FloatPosition>
                                </Point>
                                <Point id="15, 0">
                                    <FloatPosition>15.000,0.000</FloatPosition>
                                </Point>
                                <Point id="5, 8">
                                    <FloatPosition>5.000,8.000</FloatPosition>
                                </Point>
                                <Point id="0, 8">
                                    <FloatPosition>0,8.000</FloatPosition>
                                </Point>       
                            </Polygon>
                        </Element>
                    </Element>


If I try to put the size of a vertical line (<Height>(A:FUEL LEFT QUANTITY, gallons)</Height>) the bar doesn't show at all (I have tried formatting the variable to a decimal and floating point without success either).
Same if I try to do it with a Polygon and putting its upper Y's as the fuel quantity.

Thank you all for your help again!
 
Hey Heretic, thanks for your reply!
While looking for HeightScript on the forum, I managed to get a nice answer:
You have to set not only the HeightScript tag but also the Height which will be the maximum value the line will have. (In case someone stumbles with the same problem)
Thank you very much!

Code:
<Element id="White line">
                        <FloatPosition>0.000,0.000</FloatPosition>
                        <Rectangle id="Rectangle">
                            <LineWidth>1</LineWidth>
                            <Bright>True</Bright>
                            <Width>5</Width>
                            <Height>60</Height>
                            <HeightScript>(A:FUEL LEFT QUANTITY, gallons)</HeightScript>
                            <LineColor>White</LineColor>
                            <FillColor>White</FillColor>
                        </Rectangle>
                               
                    </Element>

EDIT: The HeightScript works with rectangles, not with lines.
 
Last edited:
Glad you found a solution. And thanks for posting a code example!
 
Back
Top