• 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.

P3D v2 Clock drums XML code help

Messages
95
Country
ireland
Hi all,

I have xml code for a conventional analog clock (with hands) which works perfectly. I'm trying to convert that code to use with a clock that uses rolling drums to display the time (2 each for hour, minute and second readouts) but I'm not having much luck.
The drums are ten sided with 0 to 9 marked on them, so perhaps that implies that they should be animated from 0 to 100 ? The analog hand code uses 120 for the hour hand and the minute and second hands uses 60.... (for obvious reasons), which frankly, makes any conversion a lot more confusing for me. I've searched around and found no code that might fit the bill. Can anybody offer any tips or actual code for this ?

Many thanks.

Skip
 
Analog and drums use the same code unless your trying to have the drums snap into place for each digit. Then you must use a digital string code for all the drums or you will run into issues trying to make the animation do what you want even with no lag. So make it look like drum wheels with digital numbers. This type of code can be found easy!
 
This is code from a Smith's Industries veeder counter measuring DME.
So it 's easily adapted to becoming a timer.
The number rolls are vertical strips 0-9
Code:
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_MASK.bmp">
         <Axis X="27" Y="19"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_4.bmp" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:NAV1 DME, nmiles) 1000 + d 0.5 r flr d 100 / 10 % flr  r 100 %  99 == if{ + } </Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
         <Delay PixelsPerSecond="20"/>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_MASK.bmp">
         <Axis X="36" Y="19"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_4.bmp" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:NAV1 DME, nmiles) 1000 + d 10 * 10 % 10 / r flr d 10 / 10 % flr  r 10 %  9 == if{ + } </Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
         <Delay PixelsPerSecond="20"/>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_MASK.bmp">
         <Axis X="45" Y="19"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_4.bmp" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:NAV1 DME, nmiles) 10 %</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
      </Shift>
   </Element>
   <Element>
      <Position X="26" Y="23"/>
    <Select>
         <Value>(A:CIRCUIT GENERAL PANEL ON, bool) if{ (A:NAV1 DME, nmiles) } els{ 0 }</Value>
         <Case Value="0">
            <Image Name="DME_OFF.bmp" Luminous="1"/> <----- this is a bar across the numbers when out of range or off.
         </Case>
      </Select>
   </Element>
 
Hi guys, Many thanks indeed for your interesting suggestions. I actually got the code sorted out eventually.
Instead of mapping a 2D gauge to a 'special poly' in the usual manner, I thought that I'd create the drums in 3D instead.
So for anybody searching in the future, here is the code for hour, minute and second drums ....... ('hour' and 'minute' drums are working perfect, I haven't tested the 'second' drums but they should work).
The last item of code is for the normal flashing colon between the hour and minute figures.

Regarding the other functions of the chronometer, well, that's for another day :)

Skip

Code:
<PartInfo>
    <Name>L200_CHRONO_drum_HR1</Name>
     <AnimLength>300</AnimLength>
     <Animation>
          <Parameter>
          <Code>(E:LOCAL TIME, hour) 10 / flr 30 * </Code>
          </Parameter>
     </Animation>
</PartInfo>

<PartInfo>
    <Name>L200_CHRONO_drum_HR2</Name>
     <AnimLength>300</AnimLength>
     <Animation>
          <Parameter>
          <Code>(E:LOCAL TIME, hour) 10 % flr 30 *</Code>
          </Parameter>
     </Animation>
</PartInfo>

<PartInfo>
<Name>L200_CHRONO_drum_MIN1</Name>
<AnimLength>300</AnimLength>
<Animation>
  <Parameter>
   <Code>(E:LOCAL TIME, minute) flr 60 %  10 / flr 30 * </Code>
  </Parameter>
</Animation>
</PartInfo>

<PartInfo>
    <Name>L200_CHRONO_drum_MIN2</Name>
    <AnimLength>300</AnimLength>
    <Animation>
        <Parameter>
            <Code> (E:LOCAL TIME, minutes) 10 % flr 30 * </Code>
        </Parameter>
    </Animation>
</PartInfo>

<PartInfo>
    <Name>L200_CHRONO_drum_SEC1</Name>
    <AnimLength>300</AnimLength>
    <Animation>
        <Parameter>
        <Code> (E:LOCAL TIME, seconds) 10 / flr 30 * </Code>
        </Parameter>
    </Animation>
</PartInfo>

<PartInfo>
    <Name>L200_CHRONO_drum_SEC2</Name>
    <AnimLength>300</AnimLength>
    <Animation>
        <Parameter>
        <Code> (E:LOCAL TIME, seconds) 10 % flr 30 * </Code>
        </Parameter>
    </Animation>
</PartInfo>

<PartInfo>
   <Name>L200_CHRONO_COLON</Name>
  <Visibility>
   <Parameter>
   <Code> (P:Absolute time, seconds) 1 % 0.7 1 * > ! if{ 1 } els{ 0 } </Code>
   </Parameter>
  </Visibility>
</PartInfo>



CHRONO_026.jpg
 
Last edited:
Thanks Vololiberista, That code will be handing for some other drums i use. I am not sure what will be harder to figure out, how to spell your name or decode the math triggers above!o_O
 
Back
Top