Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Some Basic XML Gauge Questions

Featured Replies

I am new to both XML and FSX gauges and have been looking at existing code as a learning exercise. In this regard, I have some questions about the small code segment below which is from the default FSX CRJ-700 pfd.xml file (if this is not the best place for this, moderator please delete post).

<Element id="Altitude Strip">
  <FloatPosition>0.000,0.000</FloatPosition>
  <Image id="pfd_altitude_strip.bmp" Name="pfd_altitude_strip.bmp">
    <Transparent>True</Transparent>
    <Axis>-19.000,498.000</Axis>
    <Bright>True</Bright>
  </Image>
  <MaskImage id="pfd_altitude_strip_mask.bmp"    Name="pfd_altitude_strip_mask.bmp">
    <Axis>0.000,72.000</Axis>
  </MaskImage>
  <Shift id="Shift">
    <Scale>0.000,0.327</Scale>
    <Expression id="Expression">
      <Minimum>-2000.000</Minimum>
      <Maximum>1000.000</Maximum>
      <Script>
        (P:Units of measure, enum) 2 ==
        if{ (A:Indicated Altitude:1, meters) }
        els{ (A:Indicated Altitude:1, feet) }
        99999 min -9999 max s0 1000 % flr
        s1
        l0 1000 <
        if{ l1 1000 - } els{ l1 }
      </Script>
    </Expression>
    <FailureTable id="FailureTable">
      <Failure id="Failure">
      </Failure>
    </FailureTable>
  </Shift>
My interpretation of the Shift code is the vertical movement of the altitude strip will be scaled (multiplied) by 0.327 and the min and max movement in pixels is -2000 to +1000 (after scaling or before?), or is it the "answer" from the Script calculation that will be scaled by 0.327?  Then assuming we are dealing with altitude in feet, we check to make sure the altitude is between -9999 and 99999 ft. Why consider an altitude of -9999ft? The altitude is then stored in register s0, and we calculate a modulo 1000 value rounded down by the flr operation. The result, which must be less than 1000, is stored in register S1. That value from S0 (original altitude) is then pushed on the stack and we ask if it is less than 1000. If so we subtract 1000 from it which gives a negative number ( I don't understand what this negative number represents or how it will be used unless it means move the strip down?).  If the original altitude is not less than 1000, we end up with the modulo value (which is less than 1000) from S1 which I believe is the "hundreds of feet" component of the altitude.  Am I interpreting the Script correctly? Maybe I don't clearly understand the big picture regarding this code block.

 

Finally, what is a Failure  Table?

 

Thanks very much for any help.

 

Al

Edited by n4gix
Placed script in Code Box

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.