P3D v4 Help needed please with 3D Elevator Trim Indicator Gauge

Help needed please with a 3D Elevator Trim indicator gauge.

The gauge has a +/- range of 8 degrees. I have been trying the code below, but have not seen any needle movement in sim yet.

XML:
<Animation name="P111A_ElevatorTrim"                      guid="cd9272df-5fae-4c6c-a857-346a18e7a4d2" type="Sim" typeParam="AutoPlay"  length="100" typeParam2="P111A_ElevatorTrim" />
    <PartInfo>
    <Name>P111A_ElevatorTrim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code> (A:ELEVATOR TRIM POSITION, degrees) 1 * 8 max -8 min </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_ELEVATOR_TRIM_DEGREES</TooltipID>
    </MouseRect>
  </PartInfo>


 

Heretic

Resource contributor
"8 max -8 min" should be "-8 max 8 min". Don't ask me why; this is just the way FSX' XML Parser works.
 
Between A and B which is the larger (for max) or smaller (for min) and pass that on. For example: 2 8 max , 8 is the larger so 8 is the result. 2 -8 min, -8 is the smaller so -8 is the result.

Every time I use max min I have to think about it this way because it is very counter-intuitive to how you read it.

Your other problem is even if you correct your code it will be returning values between -8 and 8. The minimum value (keyframe) you can use is 0. You cannot have negative keyframes so you need some sort of offset to get the range of values into the positive. This depends on how you have animated the part and where you have set the keyframes. For something like this I would usually add 100 to the result and then animated between keyframes 92 and 108. Most beginners would probably set -8 degrees to keyframe 0, and 8 degrees to keyframe 16 in which case you should add 8 to offset the results.
 
I have the elevator trim gauge working nicely using the code below and it starts at the 12 o'clock position with the needle moving clockwise and anticlockwise as trim is adjusted.

However, I can't seem to get the aileron and rudder trim working. I am using (A:AILERON TRIM POSITION, degrees) and (A:RUDDER TRIM POSITION, degrees)

Should I be using different variables for the aileron and rudder trim?

XML:
 <Animation name="P111A_ElevatorTrim"                      guid="cd9272df-5fae-4c6c-a857-346a18e7a4d2" type="Sim" typeParam="AutoPlay"  length="100" typeParam2="P111A_ElevatorTrim" />
    <PartInfo>
    <Name>P111A_ElevatorTrim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code> (A:ELEVATOR TRIM POSITION, degrees) 10 * 50 + </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_ELEVATOR_TRIM_DEGREES</TooltipID>
    </MouseRect>
  </PartInfo>
 
Thank you Roman.
I used (A:RUDDER TRIM, degrees) and (A:AILERON TRIM, degrees) and made a left and right aileron trim indicator so with a negative bias so that the needles did not just mirror each other.

XML:
  <Animation name="P111A_AileronTrim"                      guid="839a52f5-5de1-47a1-c2b9-7d566cde8fe0" type="Sim" typeParam="AutoPlay"  length="100" typeParam2="P111A_AileronTrim" />
    <PartInfo>
    <Name>P111A_AileronTrim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code> (A:AILERON TRIM, degrees) 10 * 50 + </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_AILERON_TRIM_DEGREES</TooltipID>
    </MouseRect>
  </PartInfo>
 
  <Animation name="P111A_AileronTrimL"                      guid="c2fc501d-2779-49c1-b5d7-1a43fbacf0ba" type="Sim" typeParam="AutoPlay"  length="100" typeParam2="P111A_AileronTrimL" />
    <PartInfo>
    <Name>P111A_AileronTrimL</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code> (A:AILERON TRIM, degrees) - 10 * 50 + </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_AILERON_TRIM_DEGREES</TooltipID>
    </MouseRect>
  </PartInfo>
 
   <Animation name="P111A_RudderTrim"                      guid="16e7e7fa-f9a9-470f-ba04-b3d3a39552d5" type="Sim" typeParam="AutoPlay"  length="100" typeParam2="P111A_RudderTrim" />
    <PartInfo>
    <Name>P111A_RudderTrim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code> (A:RUDDER TRIM, degrees) 10 * 50 + </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_RUDDER_TRIM_DEGREES</TooltipID>
    </MouseRect>
  </PartInfo>
 
Top