- Messages
- 1,407
- Country
-
Hello friends
I've been experimenting with time variables and displaying them within strings. Also, following tips kindly given by Bjoern, Luka and the FSX's online SDK (and
taking the timewatch snippets for reference). From Luka's functions in this thread, first I arranged a custom clock to learn how to get time information within custom variables and do operations. I called this test gauge "Davtron_M803_Logic_Test". This gauge, has implemented the Hour and Minute INC/DEC functions and also, the clock has the "Reset"code to set all time fields back to zero.
The "Clock with Custom Variables" works more like a chronometer.
Here is the code:
In order to understand the update section (it is the first time I use it within a gauge code), I tried to make an analysis using the stack sample shown in the wiki as reference. Here is my interpretation of the first script:
So far, so good! It worked like I intended for. Next step was to follow the Mircrosoft's "Create a Stopwatch Gauge Tutorial" in order to enhance my previouse code for the Davtron M803. In this case, two functions remain to be properly coded: Flight and Elapsed time. Although I've readed all information at hand, I am confused on how to stablish them.
(I will split this thread in parts, starting here)
I've been experimenting with time variables and displaying them within strings. Also, following tips kindly given by Bjoern, Luka and the FSX's online SDK (and
taking the timewatch snippets for reference). From Luka's functions in this thread, first I arranged a custom clock to learn how to get time information within custom variables and do operations. I called this test gauge "Davtron_M803_Logic_Test". This gauge, has implemented the Hour and Minute INC/DEC functions and also, the clock has the "Reset"code to set all time fields back to zero.
The "Clock with Custom Variables" works more like a chronometer.
Here is the code:
HTML:
<!--
Bell 407 gauges Version 2.0
Credits:
Nick Pike for his amazing tutorials.
Programming by Luka, Bjoern Kesten and Sergio Kauffman.
Graphics by Sergio Kauffman.
©2018 Luka, Bjoern Kesten and Sergio Kauffman. ®All Rights Reserved.
This software may not be copied, distributed modified, or otherwise included in any other works without permission from the Authors.
-->
<Gauge Name="Davtron_M803_Logic_Test" Version="1.0">
<Size X="750" Y="750"/>
<Image Name="Davtron_M803_LT_Background.bmp"/>
<!-- S T O P W A T C H U P D A T E L O G I C -->
<Update>
(L:M803_offset,seconds) d 0 < if{ 86400 + } (E:ZULU TIME,Seconds) + 86400 %
d 3600 / flr (>L:M803_H,number)
d 60 / flr 60 % (>L:M803_M,number)
flr 60 % (>L:M803_S,number)
</Update>
<!-- C L O C K E V E N T L O G I C -->
<Element>
<Position X="10" Y="10"/>
<FormattedText X="750" Y="122" Font="Quartz" FontSize="60" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
<String>
Standard Clock (24 hour format):\n
(%((P:LOCAL TIME,HOURS) flr 24 % d 24 r ?)%!02d!:
%((P:LOCAL TIME,MINUTES) flr 60 %)%!02d!:
%((P:LOCAL TIME,SECONDS) flr 60 %)%!02d!)
%{end}
</String>
</FormattedText>
</Element>
<Element>
<Position X="10" Y="152"/>
<FormattedText X="750" Y="750" Font="Quartz" FontSize="60" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
<String>
Clock with Custom Variables:\n
<!-- Changing this line, the reset action will put the number 24 in the hour field-->
<!--(%((L:M803_H,number) flr 24 % d 24 r ?)%!02d!: -->
(%((L:M803_H,number) flr 24 % d 0 r ?)%!02d!:
%((L:M803_M,number) flr 60 %)%!02d!:
%((L:M803_S,number) flr 60 %)%!02d!)
%{end}
</String>
</FormattedText>
</Element>
<!-- M O U S E E V E N T L O G I C -->
<Mouse>
<!-- M.1=========================Hour Increase===================================-->
<Area Left="100" Top="489" Width="88" Height="43">
<Tooltip>(Press LMB)</Tooltip>
<Cursor Type="Hand"/>
<Click>
(L:M803_H,number) ++ 24 % (>L:M803_H,number)
(L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
</Click>
</Area>
<!-- M.2=========================Hour Decrease===================================-->
<Area Left="100" Top="579" Width="88" Height="43">
<Tooltip>(Press LMB)</Tooltip>
<Cursor Type="Hand"/>
<Click>
(L:M803_H,number) -- 24 % (>L:M803_H,number)
(L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
</Click>
</Area>
<!-- M.3=========================Minute Increase===================================-->
<Area Left="252" Top="489" Width="88" Height="43">
<Tooltip>(Press LMB)</Tooltip>
<Cursor Type="Hand"/>
<Click>
(L:M803_M,number) ++ 60 % (>L:M803_M,number)
(L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
</Click>
</Area>
<!-- M.4=========================Minute Decrease===================================-->
<Area Left="251" Top="579" Width="88" Height="43">
<Tooltip>(Press LMB)</Tooltip>
<Cursor Type="Hand"/>
<Click>
(L:M803_M,number) -- 60 % (>L:M803_M,number)
(L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
</Click>
</Area>
<!-- M.5=========================Clock RESET===================================-->
<Area Left="490" Top="489" Width="88" Height="43">
<Tooltip>(Press LMB)</Tooltip>
<Cursor Type="Hand"/>
<Click>
0 (>L:M803_H,number)
0 (>L:M803_M,number)
0 (>L:M803_S,number)
(L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
</Click>
</Area>
</Mouse>
</Gauge>
In order to understand the update section (it is the first time I use it within a gauge code), I tried to make an analysis using the stack sample shown in the wiki as reference. Here is my interpretation of the first script:
So far, so good! It worked like I intended for. Next step was to follow the Mircrosoft's "Create a Stopwatch Gauge Tutorial" in order to enhance my previouse code for the Davtron M803. In this case, two functions remain to be properly coded: Flight and Elapsed time. Although I've readed all information at hand, I am confused on how to stablish them.
(I will split this thread in parts, starting here)
Last edited: