Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Timer in XML

Featured Replies

I have tried to make somekind of timer code. When you switch battery on there is a light that should light up for 60 seconds and then it should go off. I haven't got it working. How is that done?And is there a possibility to do a blinking light? There is a switch to turn it on and off?

Hey JukSii.In C there is the TokenVar ELAPSED_SECONDS. There might be something similar in XML, although I am not sure. If so, then all you have to do is initiate a variable that adds 60 to ELAPSED_SECONDS, and then just check, through a loop, if the ELAPSED_SECONDS time is still smaller than this variable.As far as the blinking light, take a look at the following code, courtesy of Arne Bartels:

		time_code_blink=fmod(pelement->source_var[1].var_value.n,BLINK_FREQUENCY);	  //recalc to something between 0...1		time_code_blink/=BLINK_FREQUENCY;		if(time_code_blink>0.5)			is_masked=TRUE;		if(is_masked)			pelement->string[selected_code_digit]=' ';

What is happening here is the function fmod is the floating point remainder of a division. The first argument passed to this function is not clear here, because the code is not complete, but it is ELAPSED_SECONDS. The second one is the BLINK_FREQUENCY, which has been defined at the beggining of my code as 0.5.What this means, as explained by the comment after //, is that time_code_blink is being calculated to something between 0 and 1 because it is the remainder, so it will never be bigger than one.Then all you need to do is see if time_blink_code is smaller or bigger than the BLINK_FREQUENCY. So in this case, with a value of 0.5, the string I have in my code will blink every second (half a second blank, half a second the character). All I have to do to change the frequency of blinks is to change the 0.5.How this translates to XML is beyond me, but I thought this could be of some help.

>I have tried to make somekind of timer code. When you switch>battery on there is a light that should light up for 60>seconds and then it should go off. I haven't got it working.>How is that done?>>And is there a possibility to do a blinking light? There is a>switch to turn it on and off?Do a search of the forum messages using the criteria "XML Timer"The solution(s) have been posted many times over the last few months! :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://mtco.com/~rsam/fartslogo.jpg

My apologies to slightly change the subject ever so slightly, but concerning strobe lights. I am learning FSDS V2 and would like to speed up the 'slow' flashing of my strobes on the project I am doing. I would love to have a 'double-flash' pause 'double-flash' frequency, but just a quicker pulse would be nice. Is there a simple simple way to get this function modified?Sincerely,Bill

>Do a search of the forum messages using the criteria "XML>Timer">>The solution(s) have been posted many times over the last few>months! :)Ooopss... ;) I tried to find something but I didn't use those words... But found them and now trying them out.Thanks. Maybe another question tomorrow :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.