• 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 gauge dev problem : shift a strip

Messages
39
Country
france
Hi everyone !

i develop some gauges for my panel aircraft and i encounter a problem.
The gauge is a tachometer with engine elapsed time. The tachometer is OK but the strips for elapsed time seems not working as it should...
the strip is a vertical image with digits from 0 to 0 including 1, 2,...0 is at the top and 9, then zero ten at the bottom.
the elapsed time would be something like 00253.34 (the dot won't appear...only image digit. The 4 first digit are black strips and the 2 last are white strips)
i use this portion of code for example for the last plain digit
<Element id="Element4">
<FloatPosition>0.000,0.000</FloatPosition>
<Image id="RPM_HM_Strip_b.bmp" Name="RPM_HM_Strip_b.bmp">
<Transparent>True</Transparent>
</Image>
<MaskImage id="rpm_mask.bmp" Name="rpm_mask.bmp">
<Axis>134.000,148.000</Axis>
</MaskImage>
<Shift id="Shift">
<Scale>0.000,1.000</Scale>
<Expression id="Expression">
<Minimum>0.000</Minimum>
<Maximum>10.000</Maximum>
<Script>(A:GENERAL ENG ELAPSED TIME:1, hours) 10 %</Script>
</Expression>
<FailureTable id="FailureTable">
<Failure id="Failure">
<Fail_Key>SYSTEM_ENGINE</Fail_Key>
</Failure>
</FailureTable>
<NonlinearityTable id="NonlinearityTable">
<NonlinearityEntry id="NonlinearityEntry">
<ExpressionResult>0.000</ExpressionResult>
<FloatPosition>0.000,0.000</FloatPosition>
</NonlinearityEntry>
<NonlinearityEntry id="NonlinearityEntry">
<ExpressionResult>10.000</ExpressionResult>
<FloatPosition>0.000,240.000</FloatPosition>
</NonlinearityEntry>
</NonlinearityTable>
</Shift>
</Element>


but if the value is different than 0 nothing appears...if the valur is zero everything is ok
any suggestion ? probably something i don't really understand in that code or something wrong i can't see...

Sorry for my poor english and Thank's for your help
 
First of all, please use the "#" key in the editor's toolbar to wrap your XML in code tags to preserve formatting.

Your table is inverted, and there is no "10" in the number strip:

Code:
<NonlinearityTable id="NonlinearityTable">
     <NonlinearityEntry id="NonlinearityEntry">
          <ExpressionResult>0.000</ExpressionResult>
          <FloatPosition>0.000,0.000</FloatPosition>
     </NonlinearityEntry>
     <NonlinearityEntry id="NonlinearityEntry">
          <ExpressionResult>10.000</ExpressionResult>
          <FloatPosition>0.000,240.000</FloatPosition>
     </NonlinearityEntry>
</NonlinearityTable>

Generally speaking though, numeric strips will begin with 0 and end with 9 as shown below. The highest 9 is the first entry in the table, and the lower 0 is the final entry in the table:
g300airspeed1stdigitcn8.jpg


Try this, and adjust your "y" pixels accordingly for the 9 digit and the 0 digit:

Code:
<NonlinearityTable id="NonlinearityTable">
     <NonlinearityEntry id="NonlinearityEntry">
          <ExpressionResult>9.000</ExpressionResult>
          <FloatPosition>0.000,100.000 </FloatPosition>
     </NonlinearityEntry>
     <NonlinearityEntry id="NonlinearityEntry">
          <ExpressionResult>0.000</ExpressionResult>
          <FloatPosition>0.000,240.000</FloatPosition>
     </NonlinearityEntry>
</NonlinearityTable>
 
Thank's for the answer Bill,

i will try that and tell you if it's ok for me...
merry christmas to you and to every one

Coming back soon !
 
:( well it seems not working even with this tips...and the reversed strip
when it's not zero, no digit is displayed...
probably it comes from the code i use...
for example i have this for the unit digit
Code:
        <Element id="Element4">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Image id="RPM_HM_Strip_b.bmp" Name="RPM_HM_Strip_b.bmp">
                <Transparent>True</Transparent>
            </Image>
            <MaskImage id="rpm_mask.bmp" Name="rpm_mask.bmp">
                <Axis>134.000,148.000</Axis>
            </MaskImage>
            <Shift id="Shift">
                <Scale>0.000,1.000</Scale>
                <Expression id="Expression">
                    <Script>(A:GENERAL ENG ELAPSED TIME:1, hours) 10 %</Script>
                </Expression>
                <FailureTable id="FailureTable">
                    <Failure id="Failure">
                        <Fail_Key>SYSTEM_ENGINE</Fail_Key>
                    </Failure>
                </FailureTable>
                <NonlinearityTable id="NonlinearityTable">
                    <NonlinearityEntry id="NonlinearityEntry">
                        <ExpressionResult>0.000</ExpressionResult>
                        <FloatPosition>0.000,0.000</FloatPosition>
                    </NonlinearityEntry>
                    <NonlinearityEntry id="NonlinearityEntry">
                        <ExpressionResult>10.000</ExpressionResult>
                        <FloatPosition>0.000,240.000</FloatPosition>
                    </NonlinearityEntry>
                </NonlinearityTable>
            </Shift>
        </Element>

the digit returned seems to be correct but the shift doesn't work at all...
 
I see nothing at all wrong with your XML script... :confused:

However, in the interests of moving forward, try using the approach ACES used for a 1's digit of an airspeed 'tape':

Code:
                <Element id="ASI Ones Strip">
                    <FloatPosition>2.000,112.000</FloatPosition>
                    <Image id="pfd_asi_detail_number_strip_ones.bmp" Name="pfd_asi_detail_number_strip_ones.bmp">
                        <Transparent>True</Transparent>
                        <Axis>-15.000,135.000</Axis>
                        <Bright>True</Bright>
                    </Image>
                    <MaskImage id="pfd_asi_detail_window_mask.bmp" Name="pfd_asi_detail_window_mask.bmp">
                        <Axis>0.000,11.000</Axis>
                    </MaskImage>
                    <Shift id="Shift">
                        <Scale>0.000,13.000</Scale>
                        <Expression id="Expression">
                            <Minimum>0.000</Minimum>
                            <Maximum>9.999</Maximum>
                            <Script>(A:Airspeed select indicated or true, knots) 0 max 10 % flr</Script>
                        </Expression>
                        <FailureTable id="FailureTable">
                            <Failure id="Failure">
                            </Failure>
                        </FailureTable>
                    </Shift>
                </Element>

The value for the <Scale> entry is number of pix from top range to bottom range divided by the total units' value...

IOW, if number of pix from 9 to 0 is 130, then:

<Scale> value is 130/10 = 13.0
 
well another try which is not working.
the strip is the same you gave...size is 18x288
the 1st 9 is at 0,24 and the last 0 is at 0,240
the size of my gauge is 244x244
the mask is the same size and the windows for digits are on the mask at 72,147 and size 18x24, then 5 other windows for other digits to horizontal position 92,112, 132, 152, 172
the code for the units is (which is position 4...result has to be something like 1234.56...one digit per window, using the same code for elements except position of axis and script)

Code:
        <Element id="Element4">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Image id="rpm_strip_b.bmp" Name="rpm_strip_b.bmp">
            </Image>
            <MaskImage id="rpm_mask.bmp" Name="rpm_mask.bmp">
                <Axis>132.000,147.000</Axis>
            </MaskImage>
            <Shift id="Shift">
                <Expression id="Expression">
                    <Minimum>0.000</Minimum>
                    <Maximum>9.000</Maximum>
                    <Script>(A:GENERAL ENG ELAPSED TIME:1, hours) 10 %</Script>
                </Expression>
                <FailureTable id="FailureTable">
                    <Failure id="Failure">
                        <Fail_Key>SYSTEM_ENGINE</Fail_Key>
                        <Fail_Action>Freeze</Fail_Action>
                    </Failure>
                </FailureTable>
                <NonlinearityTable id="NonlinearityTable">
                    <NonlinearityEntry id="NonlinearityEntry">
                        <ExpressionResult>9.000</ExpressionResult>
                        <FloatPosition>0.000,24.000</FloatPosition>
                    </NonlinearityEntry>
                    <NonlinearityEntry id="NonlinearityEntry">
                        <ExpressionResult>0.000</ExpressionResult>
                        <FloatPosition>0.000,240.000</FloatPosition>
                    </NonlinearityEntry>
                </NonlinearityTable>
            </Shift>
        </Element>

what is wrong with that ?
when the value is 0, nothing is displayed and the same with other values...:confused::banghead:
 
Hi, I believe this code or something similar should work :

Code:
<Element id="Element4">
  <FloatPosition>72.000,123.000</FloatPosition>
  <Image id="rpm_strip_b.bmp" Name="rpm_strip_b.bmp"/>
  <Shift id="Shift">
    <Expression id="Expression">
       <Script>(A:GENERAL ENG ELAPSED TIME:1, hours) 10 %</Script>
    </Expression>
    <FailureTable id="FailureTable">
       <Failure id="Failure">
          <Fail_Key>SYSTEM_ENGINE</Fail_Key>
          <Fail_Action>Freeze</Fail_Action>
       </Failure>
    </FailureTable>
    <NonlinearityTable id="NonlinearityTable">
      <NonlinearityEntry id="NonlinearityEntry">
         <ExpressionResult>0.000</ExpressionResult>
         <FloatPosition>72.000,-93.000</FloatPosition>
      </NonlinearityEntry>
      <NonlinearityEntry id="NonlinearityEntry">
         <ExpressionResult>9.000</ExpressionResult>
         <FloatPosition>72.000,123.000</FloatPosition>
      </NonlinearityEntry>
    </NonlinearityTable>
  </Shift>
  <ClipRect id="Clip">
    <FloatPosition>72.000,147.000</FloatPosition>
    <Size>18.000,24.000</Size>
  </ClipRect>
</Element>


Now, some changes and advices:

-Do not use masks if possible, the same effect can be obtained placing a <ClipRect> tag, which is more simple and efficient.
-Remove the Expression limits, they are unnecessary in this case.
-Try to understand how the strip bmp is positioned so that it would work properly. Nonlinearity must go from 0 to 9 and not otherwise in this case, so you need to recalculate the coordinates.

Good luck! :)

Tom
 
Last edited:
Using a clip rectangle is a good tip...

The order of the non linearity table simply changes the direction the digits will "roll" during transition from one number to the next...

One other "trick" that I frequently use during script editing is to use a whole number in the <Value> expression, such as 0, 5, 9 in sequence to ensure that they are being correctly displayed.

I tend to stick with FS9 schema and the non-linearity method since it will work in both FS9 and FSX, whereas the scale method won't...
 
FSX gauge dev problem : shift a strip [SOLVED]

Well, first of all, HAPPY NEW YEAR TO EACH !
Thank's for your replies.
i solved my problem...here is the part of the code modified, hoping it helps someone else.
Code:
        <Element id="Element4">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Image id="RPM_HM_Strip_b.bmp" Name="RPM_HM_Strip_b.bmp">
                <Transparent>True</Transparent>
            </Image>
            <MaskImage id="rpm_mask.bmp" Name="rpm_mask.bmp">
                <Axis>132.000,147.000</Axis>
            </MaskImage>
            <Shift id="Shift">
                <Scale>0.000,1.000</Scale>
                <Expression id="Expression">
                    <Minimum>0.000</Minimum>
                    <Maximum>10.000</Maximum>
                    <Script>(A:GENERAL ENG ELAPSED TIME:1, hours) 10 % flr</Script>
                </Expression>
                <FailureTable id="FailureTable">
                    <Failure id="Failure">
                        <Fail_Key>SYSTEM_ENGINE</Fail_Key>
                        <Fail_Action>Freeze</Fail_Action>
                    </Failure>
                </FailureTable>
                <NonlinearityTable id="NonlinearityTable">
                    <NonlinearityEntry id="NonlinearityEntry">
                        <ExpressionResult>0.000</ExpressionResult>
                        <FloatPosition>0.000,0.000</FloatPosition>
                    </NonlinearityEntry>
                    <NonlinearityEntry id="NonlinearityEntry">
                        <ExpressionResult>10.000</ExpressionResult>
                        <FloatPosition>0.000,-240.000</FloatPosition>
                    </NonlinearityEntry>
                </NonlinearityTable>
            </Shift>
        </Element>
the difference is essentially in the result positionning for the value 10.000 which is negative...and it worked.
the masking image is ok but if you have more explanations about clip rectangle i will be happy to try that if its more efficient...
thank you again and see you next time for another question/problem
 
Another option

This discussion has been very helpful as I finished a set of gauges. Thanks for all the help to a question I didn't end up having to ask. Below is my version.

Code:
        <Element id="Element">
            <FloatPosition>55.000,116.000</FloatPosition>
            <Image id="NumberStripLg.bmp" Name="NumberStripLg.bmp">
                <Axis>12.000,362.000</Axis>
                <Transparent>False</Transparent>
            </Image>
            <Shift id="Shift">
                <Scale>0.000,33.000</Scale>
                <Expression id="Expression">
                    <Script>(A:Ground Velocity, knots) 1000 / flr</Script>
                </Expression>
                <Delay id="Delay">
                    <DelayValue>20.000</DelayValue>
                </Delay>
            </Shift>
            <ClipRect id="ClipRect">
                <FloatPosition>-12.000,-33.000</FloatPosition>
                <Size>24,33</Size>
            </ClipRect>
        </Element>

ClipRect was used instead of a image mask, since the regions are simple rectangles. I hope that this is less processor intensive, since an image does not have to be bitwise combined (and).
The position for the clipping rectangles are negative, because the image axis is in the middle (left to right) and at the bottom. That is, I have to shift left and up to get to the top left of the rectangle.
Scale was used instead of nonlinearity table simply to try it out. It was easy to use, since the font size and spacing are known and easy to control with Photoshop.
 
Back
Top