XML: Timer: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
(New page: {{Infobox-Applicable-FSVersion | FSXI = true | FSXA = true | FSX = true | FS2004 = true | FS2002 = false }} == XML: Timer == With this universal code it's very simple to control not onl...)
 
mNo edit summary
Line 1: Line 1:
{{Infobox-Applicable-FSVersion
{{Infobox-Applicable-FSVersion
| FSXI = true
| FSXI = false
| FSXA = true
| FSXA = true
| FSX = true
| FSX = true

Revision as of 16:51, 9 August 2011


XML: Timer

With this universal code it's very simple to control not only the length of the cycle but the frequency of the blink itself:

Pseudocode:

<Visible>(P:Absolute time,seconds) "seed" % "blink lapse" > !</Visible>

The seed parameter is the total length of the blinking cycle. For example, if you want something to blink once every second, you use 1, if you want it blink every half a second, use 0.5 , every two seconds, 2 ,etc.

For each seed, you can determine how long would be the duration of both the visible and invisible part. Then:

(P:Absolute time,seconds) 1 % 0.5 > ! 

this will make the visible and invisible parts of half a second each.

(P:Absolute time,seconds) 1 % 0.7 > ! 

this will make the visible part 70% of the cycle (0.7 secs) and invisible parts of 30 % (0.3 secs).

(P:Absolute time,seconds) 0.5 % 0.25 > ! 

this will make the visible and invisible parts a quarter of second each. You can invert the cycle by removing the "!" char.