• 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.

FSXA Alternating flashing strobe light

euroastar350

Resource contributor
Messages
863
Country
us-delaware
Hi guys,

I'm looking for a way to make my strobe light flash similar to a pulse light or alternating flash. I've tried using the pulse light script posting by Bill L years ago with no success. Here is the script I am using:

Code:
<PartInfo>
    <Name>B222_strobe_light</Name>
    <Visibility>
      <Parameter>
        <Code>(A:LIGHT STROBE,bool)
          (A:ELECTRICAL MASTER BATTERY,bool)
          and
          if{
          (P:Absolute time,seconds) 2 % 0.4 > !
          if{
          (P:Absolute time,seconds) 0.2 % 0.1 > !
          if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

And since I am posting about lights, I wanted to make them flash 3 times like the real deal, but I haven't had much luck getting them to flash the way I want to. Would have to increase or decrease the percentage and time to get them to flash the way I want to? Any help is appreciated on both.
 
The problem is that you've left out two very critical } symbols to complete the "logic."
Code:
    <!-- STROBE LIGHT FLASHER -->
    (A:LIGHT STROBE,bool)
    (A:ELECTRICAL MASTER BATTERY,bool)
    and
    if{
        (P:Absolute time,seconds) 2 % 0.4 > !
          if{
              (P:Absolute time,seconds) 0.2 % 0.1 > !
                 if{ 1 (>L:B737_Strobe,bool) }
                els{ 0 (>L:B737_Strobe,bool) }
            }
       }
I've added some indent structure to make it more visible. Note that the two closing symbols } are lined up with their corresponding opening { symbols! :teacher:
 
Your missing the "seed". Try adding 1 *

(P:Absolute time,seconds) 2 % 0.4 1 * > !
Uh, the number "2" is the "seed"...
I keep this "comment" at the top of every modeldef.xml to remind me of the syntax and structure of this neat bit of script:
Code:
<!--
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 on 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 both.
 
(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 both.
You can invert the cycle by removing the "!" char.
-->
 
As for getting a "triple flash" you could try nesting an additional 'blink condition' and adjust both the "seed" and "blink lapse" timings. Don't forget to match of the opening and closing if{ } symbols! ;)
 
I wanted to make them flash 3 times like the real deal,

What you want to do is indeed a bit tricky.
First, you need to determine the complete flashing cycle.

Let's make it simple as 1/1 = 1 second active (flashing period) - 1 second inactive (flashing is off)

Now let's use three flashers per period. That means , within a second, 1 (flash) - 0 (off) - 1 (flash) - 0 (off) - 1 (flash).
Then we have 5 subperiods, so each one equals 0.20 of a second.

Finally, we code the formula as

Code:
<Code>
   (A:LIGHT STROBE,bool)
   (A:ELECTRICAL MASTER BATTERY,bool)
   and
   if{
        (P:Absolute time,seconds) 2 % 1 > !
        if{
             (P:Absolute time,seconds) 0.40 % 0.20 > !
             if{ 1 } els{ 0 }
           }
      }
</Code>


With this logic you can use whatever time lapse for any of the cycles.

Tom
 
Last edited:
As for getting a "triple flash" you could try nesting an additional 'blink condition' and adjust both the "seed" and "blink lapse" timings. Don't forget to match of the opening and closing if{ } symbols! ;)

Is this similar to the pulse light setup or do I have to do additional work to make them flash alternate? I'm using a 3 position switch to control the strobes and beacon

What you want to do is indeed a bit tricky.
First, you need to determine the complete flashing cycle.

Let's make it simple as 1/1 = 1 second active (flashing period) - 1 second inactive (flashing is off)

Now let's use three flashers per period. That means , within a second, 1 (flash) - 0 (off) - 1 (flash) - 0 (off) - 1 (flash).
Then we have 5 subperiods, so each one equals 0.20 of a second.

Finally, we code the formula as

Code:
<Code>
   (A:LIGHT STROBE,bool)
   (A:ELECTRICAL MASTER BATTERY,bool)
   and
   if{
        (P:Absolute time,seconds) 2 % 1 > !
        if{
             (P:Absolute time,seconds) 0.40 % 0.20 > !
             if{ 1 } els{ 0 }
           }
      }
</Code>


With this logic you can use whatever time lapse for any of the cycles.

Tom

Works a treat Tom, really much appreciate it
 
Uh, the number "2" is the "seed"...
I keep this "comment" at the top of every modeldef.xml to remind me of the syntax and structure of this neat bit of script:
Code:
<!--
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 on 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 both.

(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 both.
You can invert the cycle by removing the "!" char.
-->

The example i have uses....... "seed" % "blink lapse" "seed" * > !

So i was talking about the second seed. Seems that you guys do not use a second seed. So maybe i never need to use it unless you plan on multiplying once again. Not sure why there is a second seed!
 
2D gauge based code requiring Doug's XML sound gauge (for the "Is FSX paused?" variable) so that the sequencing can be altered ad lib without requiring access to the model:

Code:
(L:FSSimIsPaused, number) 1 !=
  if{ (L:Strobe Timer, number) ++ 30 % d (&gt;L:Strobe Timer, number)
  (L:Beacon Timer, number) ++ 45 % d (&gt;L:Beacon Timer, number) }
 
  (L:Strobe Timer, number) 28 ==
  if{ 1 (>L:Strobe Right, bool) }
  (L:Strobe Timer, number) 29 ==
  if{ 0 (>L:Strobe Right, bool) }
  (L:Strobe Timer, number) 1 ==
  if{ 1 (>L:Strobe Right, bool) }
  (L:Strobe Timer, number) 2 ==
  if{ 0 (>L:Strobe Right, bool) }
  (L:Strobe Timer, number) 10 ==
  if{ 1 (>L:Strobe Left, bool) }
  (L:Strobe Timer, number) 11 ==
  if{ 0 (>L:Strobe Left, bool) }
  (L:Strobe Timer, number) 13 ==
  if{ 1 (>L:Strobe Left, bool) }
  (L:Strobe Timer, number) 14 ==
  if{ 0 (>L:Strobe Left, bool) }
 
  16 31 (L:Beacon Timer, number) rng
  if{ 1 (>L:Beacon Splash, bool) }
  els{ 0 (>L:Beacon Splash, bool) }
 
The example i have uses....... "seed" % "blink lapse" "seed" * > !

So i was talking about the second seed. Seems that you guys do not use a second seed. So maybe i never need to use it unless you plan on multiplying once again. Not sure why there is a second seed!

The second seed can be used basically for long cycles (more than 2 seconds) when it would be easier to define the blinking period in a percentage of the complete cycle instead of plain seconds. It is depicted and explained in the wiki:

Code:
(P:Absolute time,seconds) 12 % 0.7 12 * > !

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

Tom
 
This post helped me achieve the settings I desired so to all on here thank you kindly.

EDIT

Spoke too soon. I realized I needed to have my strobes blink 47 +/- 5 a minute so I went adjusting to achieve this however my Strobe bulb flashing will not sync strobe flash on the ground.

As for code I have them (Bulb Light & Ground Splash) both using the same code but separate entries as I have an altitude restriction on the Ground Splash.

EDIT#2 Fixed it. Will Post video if able to show update.
 
Last edited by a moderator:
Back
Top