• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Adding an offset to XML timer

Messages
657
Country
us-illinois
I'm trying to adapt the code sample presented in the "XML Timer" wiki article to a pair of alternating beacon lights on my aircraft. I have a working code for both lights flashing simultaneously, but haven't found a way to add a specified delay to one and produce the alternating effect. My idea was to use my current code for one light and an offset version for the other.

The sample pseudocode...
Code:
<Visible>(P:Absolute time,seconds) "seed" % "blink lapse" "seed" * > !</Visible>

What I have now...

Code:
<PartInfo>
<Name>605_beacon</Name>
    <Visibility>
    <Parameter>
        <Code>
        (A:LIGHT BEACON,bool)
        (A:ELECTRICAL MASTER BATTERY,bool)
        and
        if{
        (P:Absolute time,seconds) 1.7 % 0.1 1.7 * > !
        if{ 1 } els{ 0 }
        }
        </Code>
    </Parameter>
    </Visibility>
</PartInfo>

Now, I've found various other codes that omit the second "seed" entry and the following asterisk, which works exactly the same way as above. But I can't figure out how to add an offset of half the total cycle time to one of these lights. Also, the second "seed" value seems to only scale the previous term.

So how would I go about adding a delay to only the first "blink" while leaving every other cycle untouched? It seems like a very simple task but I have yet to find anything relevant and useful on the interwebs.
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
I'm trying to adapt the code sample presented in this article to a pair of alternating beacon lights on my aircraft.

So you have two parts, flashing opposite during a t cycle of half on/half off ?

Then

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

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

Unless otherwise, that's it.

Tom
 
Messages
657
Country
us-illinois
So you have two parts, flashing opposite during a t cycle of half on/half off ?

Then

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

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

Unless otherwise, that's it.

Tom

That would make perfect sense if both lights were truly alternating with no time gap between them, however the tricky part is getting the second beacon to "blink" at exactly the halfway point of the other light's resting cycle. The sequence should go like this: Top light rapid flash > rest > bottom light rapid flash > rest...But from what I understand, removing the "!" only reverses the cycle. That means I would still have ("seed" minus "blink lapse") seconds between the two lights. I could see something like this work for pulsating landing lights though.
 
Messages
2,077
Country
us-ohio
Ozzy... just FYI... landing lights like that are something I control... so, no need for you to write code for that. In fact, we would probably discuss lights and other fun things before you dive too deep into the XML rabbit hole.
 
Messages
1,451
Country
mexico
Ozzy... just FYI... landing lights like that are something I control... so, no need for you to write code for that. In fact, we would probably discuss lights and other fun things before you dive too deep into the XML rabbit hole.

Hello Sr., would you be so kind to elaborate? This topic is very interesting. Thank you kindly.
 
Messages
683
Country
us-california
It has to do with the fact that Ozzy's question involves an EagleSoft project that WarpD will be doing the coding for. ;)
 
Messages
1,468
Country
italy
You could do something scary and start with one light off and the other light on. If the interval is the same for both then they would both probably alternate properly.
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
That would make perfect sense if both lights were truly alternating with no time gap between them, however the tricky part is getting the second beacon to "blink" at exactly the halfway point of the other light's resting cycle. The sequence should go like this: Top light rapid flash > rest > bottom light rapid flash > rest...But from what I understand, removing the "!" only reverses the cycle. That means I would still have ("seed" minus "blink lapse") seconds between the two lights. I could see something like this work for pulsating landing lights though.

Ok, now I see what you actually need. That would be simple to code in XML using an elapsed timer for the whole cycle and anothe for the rest period.
Anyway I guess Ed can handle that very well in C++;)

Tom
 
Messages
258
Country
ireland
In my XML innocence I would have had a counter incrementing from 0 to say 29 and then resetting.

The first light would be visible and flashing when the counter is between 0 and 10.

The second light would be visible and flashing when the counter is between 15 and 25.

Then I would scale the numbers up and about to suit the aesthetics.

Walter
 
Top