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

FS2004 Is an analog clock possible with xml code

Messages
231
Country
us-alabama
I am trying to write xml code for a 2d analog 24 hour clock. This is for FS2004. I have gotten the hour hand to function for the first 24 hours, but when time kicks over to 0:0:01, the needle rotates counter clock wise to the 0:0:01 position.

I have searched the gauge forum for threads relating to clocks and been unable to find anything that helps. I am a newbie, so it is probably something simple I am missing or don't understand in the threads I have been reading.

Would some one take a look at my code and let me know how badly I have screwed up?

Code:
<Gauge Name="f4u1 clock" Version="1.0">
   <Image Name="f4u1_clock_background.bmp" ImageSizes="1200,1200,1200,1200"/>
    <Element>
      <Position X="600" Y="600"/>
      <Image Name="f4u1_clock_day_hand.bmp" PointsTo="North" 

ImageSizes="80,230,80,230">
         <Axis X="40" Y="190"/>
      </Image>
      <Rotate>
         <Value Minimum="0" Maximum="31">(P:Local time,day)</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="590" Y="410"/>
            <Item Value="31" X="562" Y="413"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="02"/>
      </Rotate>
   </Element>
    <Element>
      <Position X="600" Y="600"/>
      <Image Name="f4u1_clock_hour_hand.bmp" PointsTo="North" 

ImageSizes="63,340,63,340">
         <Axis X="31" Y="313"/>
      </Image>
      <Rotate>
         <Value>(P:Local time,hours)</Value>
         <Nonlinearity>
            <Item Value="0" X=" 601" Y="410"/>
            <Item Value="12" X="600" Y="912"/>
            <Item Value="24" X="600" Y="410"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
         <Delay DegreesPerSecond="24"/>
      </Rotate>
   </Element>
   <Mouse>
      <Tooltip ID="TOOLTIPTEXT_CLOCK"/>      
   </Mouse>
</Gauge>

Carl
 
It is this line:
<Delay DegreesPerSecond="24"/>

This tells the needle that it can move no faster than 24 degrees persecond.
When you pass 24 hours the needle goes from 24 hours to 0 hours and the needle must go counterclockwise from 360 derees to 0 degrees.
Since the rotationspeed is limited to 24 degrees/second it will take 15 seconds to complete the full counterclockwise rotation.

If you remove the restriction the needle can jump from 360 degrees to 0 degrees instantly.

If you want the hour needle to move smoothly instead suddenly jumping to the next hour then you must not use just the hour of the day, which is the number of hours past the last midnight, but the total amount of hours past a fixed point in the past.
You use the start of the year as a reference:
(P:LOCAL DAY OF YEAR , number) 24 * (P:LOCAL TIME time, hours) +
This should work as long as you don't fly on new year's eve.

Another option is to use (P:ABSOLUTE TIME, seconds) (Time, as referenced from 12:00 AM January 1, 0000) and store the difference between this and (P:LOCAL TIME, seconds) when the gauge at startup.
Then you use that difference to convert ABSOLUTE TIME to LOCAL TIME.
 
The analog clock on the VC10 uses zulu warrior time
Code:
<Value>(P:Zulu time,seconds) flr 60 %</Value>
<Value>(P:Zulu time,minutes) flr 60 %</Value>
<Value>(P:Zulu time,hours)</Value>

It works fine at any time of day.
vololiberista
 
jeroen79 and vololiberista

Removing the delay line worked, the hand does not jump to the next hour, it jumps in about 2-3 minute increments thru the hour giving the effect of a mechanical analog hour hand, that to me is quite satisfactory. I hope my editor is happy with it too. Now I can work on adding the hour hand and second hand bitmap entries with some confidence.

Which leaves me with one challenge, the day hand bitmap, this clock features a day of the month dial. I have been unable to get the f4u1_clock_day_hand.bmp to move using the <Value Minimum="0" Maximum="31">(P:Local time,day)</Value> line. I am using it because it lines the bitmap up at the 0 mark on the back ground. I originally tried using
<Value Minimum="0" Maximum="31">(P:LOCAL DAY OF MONTH,day)</Value> and the f4u1_clock_day_hand.bmp started up at the correct position for the flight time but failed to move when I changed the date. I think adding a 15.5 item value in the nonlinearity section may help with the movement problem.

Carl
 
Guys

It took a couple of more changes (and beers) to work out the challenge. But here is the working code

Code:
<Gauge Name="f4u1 clock" Version="1.0">
   <Image Name="f4u1_clock_background.bmp" ImageSizes="1200,1200,1200,1200"/>
    <Element>
      <Position X="600" Y="600"/>
      <Image Name="f4u1_clock_day_hand.bmp" PointsTo="North" 

ImageSizes="80,230,80,230">
         <Axis X="40" Y="190"/>
      </Image>
      <Rotate>
         <Value Minimum="0" Maximum="31">(P:Local day of month,number)</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="562" Y="413"/>
            <Item Value="15.5" X="635" Y="787"/>
            <Item Value="31" X="562" Y="413"/>
         </Nonlinearity>
      </Rotate>
   </Element>
    <Element>
      <Position X="600" Y="600"/>
      <Image Name="f4u1_clock_hour_hand.bmp" PointsTo="North" 

ImageSizes="63,340,63,340">
         <Axis X="31" Y="313"/>
      </Image>
      <Rotate>
         <Value>(P:Local time,hours)</Value>
         <Nonlinearity>
            <Item Value="0" X=" 601" Y="410"/>
            <Item Value="12" X="600" Y="912"/>
            <Item Value="24" X="600" Y="410"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
      </Rotate>
   </Element>
    <Element>
      <Position X="600" Y="600"/>
      <Image Name="f4u1_clock_min_hand.bmp" PointsTo="North" 

ImageSizes="62,491,62,491">
         <Axis X="31" Y="462"/>
      </Image>
      <Rotate>
         <Value>(P:Local time,minutes)</Value>
         <Nonlinearity>
            <Item Value="0" X=" 600" Y="138"/>
            <Item Value="30" X="600" Y="1062"/>
            <Item Value="60" X="600" Y="138"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
      </Rotate>
   </Element>
    <Element>
      <Position X="600" Y="600"/>
      <Image Name="f4u1_clock_sec_hand.bmp" PointsTo="North" 

ImageSizes="60,711,60,711">
         <Axis X="30" Y="465"/>
      </Image>
      <Rotate>
         <Value>(P:Local time,seconds)</Value>
         <Nonlinearity>
            <Item Value="0" X=" 600" Y="135"/>
            <Item Value="30" X="600" Y="1065"/>
            <Item Value="60" X="600" Y="135"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
         </Failures>
      </Rotate>
   </Element>
   <Mouse>
      <Tooltip ID="TOOLTIPTEXT_CLOCK"/>      
   </Mouse>
</Gauge>

I added the 15.5 Item value to the Nonlinearity section for the
f4u1_clock_day_hand.bmp, it still did not move. So I changed (P:Local day of month,day) to (P:Local day of month,number). The gauge looks like it works fine now. Of course the couple of beers may be blurring me vision.

Carl
 
I added the 15.5 Item value to the Nonlinearity section for the
f4u1_clock_day_hand.bmp, it still did not move. So I changed (P:Local day of month,day) to (P:Local day of month,number).
Of course it didn't work, Carl. We can't just make up our own "units" for the variables. We are limited to the ones cited in the SDK... :wizard:

I'm glad to read you got it sorted out now though. Congratulations!
 
Guys
Well the beers did not blur my vision, just my manners, jeroen79 and vololiberista I forgot to thank you for your help. Thank you! Very much! Sorry to be late with the Thank you.

Carl

Bill
I frequently make that kind of "stoopud" mistake. Then spend half a week searching thru the forum posts to find out just how stoopud I have been. It plays hobb with my production schedule but turns out to be a good learning experience.

Carl
 
Last edited:
We all make s******d mistakes!!!!!
I often go to bed with an unresolved problem and end uo with a totally different approach the next day. XML is a pain invented by someone with a very warped sense of humour!!
vololiberista
 
Back
Top