1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FSXA Analog Kohlsman not staying in sink with mouse clicks

Discussion in 'Gauges' started by delivery guy, 12 Aug 2017.

  1. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    Country:
    unitedstates
    Analog Kohlsman not staying in sink with mouse clicks. And when i click STD it says 29.91 and the tooltip says 29.92.

    Has anyone ran into this issue? i use 10 keyframes for the drum wheels. I tried using 100 to see if the 1000th value would average out as you rotate the value. But this also was out of sink with the tooltip value. But the math is correct because it seems to catch back up when it falls behind or vice versa.

    For the 1000th wheel i am using 10 animated frames with this code.
    I also tried not rounding down with no flr in the code.

    Code:
    (A:KOHLSMAN SETTING HG, INHG) 99 min 0 max 0.1 % 0.01 / flr
    Seems to me the issue is the default coding because the math is correct.:rolleyes:
     
    Last edited: 12 Aug 2017
  2. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,757
    Country:
    unitedstates
    Try adding 'abs' and use 'near' instead of 'flr':
    Code:
    <Code>(A:KOHLSMAN SETTING HG, inHg) abs 99 min 0 max 0.1 % 0.01 / near</Code>
     
  3. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    Country:
    unitedstates
    That worked perfect. But now i have another issue. The 100th drum is rounding down when it's time to flip up 1 value.
    Example.....89, 80, 91

    So i tried using near and then it flips 84, 95, 96.

    Why?
     
  4. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,757
    Country:
    unitedstates
    Here are mine tested and working perfectly:
    Code:
      <PartInfo>
        <Name>C310_baro_hundths</Name>
        <AnimLength>9</AnimLength>
        <Animation>
          <Parameter>
            <Code>(A:KOHLSMAN SETTING HG, inHg) abs 99 min 0 max 0.1 % 0.01 / near</Code>
          </Parameter>
        </Animation>
        <MouseRect>
          <TooltipID>TOOLTIPTEXT_ALTIMETER_FEET_METERS_SPECIAL</TooltipID>
        </MouseRect>
      </PartInfo>
    
      <PartInfo>
        <Name>C310_baro_tenths</Name>
        <AnimLength>9</AnimLength>
        <Animation>
          <Parameter>
            <Code>(A:KOHLSMAN SETTING HG, inHg) abs 99 min 0 max 1 % 0.1 / flr</Code>
          </Parameter>
        </Animation>
        <MouseRect>
          <TooltipID>TOOLTIPTEXT_ALTIMETER_FEET_METERS_SPECIAL</TooltipID>
        </MouseRect>
      </PartInfo>
    
      <PartInfo>
        <Name>C310_baro_1</Name>
        <AnimLength>9</AnimLength>
        <Animation>
          <Parameter>
            <Code>(A:KOHLSMAN SETTING HG, inHg) abs 99 min 0 max 10 % 1 / flr</Code>
          </Parameter>
        </Animation>
        <MouseRect>
          <TooltipID>TOOLTIPTEXT_ALTIMETER_FEET_METERS_SPECIAL</TooltipID>
        </MouseRect>
      </PartInfo>
    
      <PartInfo>
        <Name>C310_baro_10</Name>
        <AnimLength>9</AnimLength>
        <Animation>
          <Parameter>
            <Code>(A:KOHLSMAN SETTING HG, inHg) abs 99 min 0 max 100 % 10 / flr</Code>
          </Parameter>
        </Animation>
        <MouseRect>
          <TooltipID>TOOLTIPTEXT_ALTIMETER_FEET_METERS_SPECIAL</TooltipID>
        </MouseRect>
      </PartInfo>
     
    antaris likes this.
  5. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    Country:
    unitedstates
    Thanks for sharing your code Bill. I use the same code but what i learned today is i do not need to use 10 key frames with a second zero at the end.

    It's easier to divide the drum by 10 images but if the drum only has 9 key frames then you still can divide by 10 but just use 9 images. So thanks again as this finally solved the issue why i was always in and out of sink.

    I have to say it is almost perfect but i still find that it can skip a value every 2 or 4 cycles in the 100th and the 1000th value. So this to me is a fsx bug and not coding. But with your help my values are near perfect now.
     
    Last edited: 13 Aug 2017
  6. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,757
    Country:
    unitedstates
    That's your problem, the zero is repeating (frame 10). Consecutive single digit numbers will never reach 10...

    Number strip should run:
    0 1 2 3 4 5 6 7 8 9
     
  7. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    Country:
    unitedstates
    Yes that fixed it but all other custom drum wheels that use enum or bool will work using 10 key frames because 10 becomes 0 and i use the number zero twice.
    But for reading variables i am learning now it causes an issue as we both are talking about. So i updated all my codes to only use 9 key frames and i still put 10 images on the drum wheel so it divides evenly.

    So another lesson learned as gauges take years to master!:wizard:
     

Share This Page