Sign in to follow this  
rcbarend

Timer in XML gauge

Recommended Posts

FSDS2.4 & fs9I want to use a timer function in an XML gauge to delay the apperance of bitmaps on the gauge.I have got the gauge working as I want using the 'spoilers' token variable and setting the time in the aircraft.cfg file.However inadvertant use of the / key upsets the sequencing.I note the 'TICK18' token variable in the fs9 SDK, used for "general purpose timing", but I have not been able to get it to work.Does anyone know the syntax to use TICK18 please?Regards Ted

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Ted,I don't know about the TICK18 function, but here's how I do timing in all my gauges.Start timer:(P:ZULU Time,seconds) (>G:Var1)Test on timer elapse (example: 5.1 sec)(P:ZULU Time,seconds) (G:Var1) 5.1 + >if{ .........}The only disadvantage is, that this doesn't work on a date change when the timer is running (ZULU time becomes 0).(requires extra code to solve this).But for short timers, which are only occasionally running, the chance of this happening is not very big :-)Cheers, Rob

Share this post


Link to post
Share on other sites

Thanks Rob -- The gauge is now working using your code.I am still curious about the TICK18 function though as it seems to be designed for the job.Regards Ted

Share this post


Link to post
Share on other sites

TICK18 is a variable accessible only for C gauges.Rob, you might have a look at "ABSOLUTE TIME". If I recall that right it doesn't have a rollover (with unit "number", or "seconds"). As a C programmer I would use "ELAPSED_SECONDS", but I don't know if there is a XML equivalent.Arne Bartels

Share this post


Link to post
Share on other sites

Gentlemen The routine works with ABSOLUTE TIME using units of seconds or number. I shall use the 'seconds option as I need all the remarks or notes I can to remind me two days later.Thank you both for the help. Regards Ted

Share this post


Link to post
Share on other sites

Hi Arne,I did try that, but I could never figure out how it worked.So I tried again ....%((P:ABSOLUTE TIME,number) )%!d! And this gave me a very large negative value, which increments by one every second.So I got my calculator.And it appears that AbsoluteTime in FS2004 is relative to:*** 14-July-2042, 01.04 AM GMT ***I tried several timesettings in between (by setting the date/time in FS2004 differently), loaded the same flight several times, even changed the date/time on my PC, but it always gave me the same date/time.Question: can you explain this funny date ?? Looks like a delayed millenium bug to me :-)Rob BarendregtPS: Apart from that: yes, it works OK for measuring time intervals.No date reset, no timezone change (like LOCAL TIME)..

Share this post


Link to post
Share on other sites

You might have an integer overrun here with !%d!. Have you tried !%.0f! instead? I tried to get it from a C gauge with: execute_calculator_code("(P:ABSOLUTE TIME,number)",&val,NULL,NULL); and got something like 63221503248.0 which is 2003 years and a bit (one year 365.25*24*60*60 seconds, so Julian date, not Gregorian).Arne Bartels

Share this post


Link to post
Share on other sites

Hi Arne,You could very well be right about the overflow :-)Anyway, it's not really relevant if you just use ABSOLUTE TIME to do interval timing. Cheers, Rob

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this