XML: Macros - Universal Timer
From FSDeveloper Wiki
Universal Timer Macros
Making elapsed time based on gauge update cycle is simple to code and easy to understand.
Courtesy of Tom Aguilo (taguilo) in post: http://www.fsdeveloper.com/forum/threads/adding-a-timer.431123/#post-681198
A group of macros, but with an universal score could be :
<Macro Name="GetElapsed"> (P:Absolute time,@2) (L:@1,@2) - abs </Macro> <Macro Name="SetElapsed"> (P:Absolute time,@2) (>L:@1,@2) </Macro>
And then using:
@SetElapsed(name_of_var,unit) @GetElapsed(name_of_var,unit)
For example (pseudocode):
<Update>
(A:TURB ENG ITT:1, celsius) 907 >
if{ @SetElapsed(MyTimer,minutes) }
...
...
@GetElapsed(MyTimer,minutes) 5 >
if{ do something }
...
</Update>
Both macros can be copied and pasted on every gauge so to have elapsed timers available for the entire code.