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

P3D v3 FS9 code for 4 windows that blink up in order; System Check

Messages
10,088
Country
us-arizona
Hey all,

Trying to get a code to work. Click the screen button, and 4 windows pop up for about 4 seconds each.

My thoughts were that if I start a timer, the first shows up automatically. Then have the other 3 show up in 'range' in seconds zones.

This is what I have so far.

Code:
    <Element>
    <Visible> (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 16 &lt; and </Visible>
         <Position X="300" Y="100"/>
       <Image Name="111.bmp"/>
     </Element>

    <Element>
    <Visible> (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) 9 12 (L:FLASH SCREENS CLICK START, seconds) rng and </Visible>
         <Position X="300" Y="100"/>
       <Image Name="222.bmp"/>
     </Element>

    <Element>
    <Visible> (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) 4 9 (L:FLASH SCREENS CLICK START, seconds) rng and </Visible>
         <Position X="300" Y="100"/>
       <Image Name="333.bmp"/>
     </Element>

    <Element>
    <Visible> (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) 1 4 (L:FLASH SCREENS CLICK START, seconds) rng and </Visible>
         <Position X="300" Y="100"/>
       <Image Name="444.bmp"/>
     </Element>

    <Element>
          (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS PROGRAM, bool) }
    </Element>

The last code block above clears out the click zone, reset block.

This is the click zone;

Code:
     <!-- FLASH SCREENS WINDOW //////////////////////////////////////////// -->
      <Area Left="1" Right="100" Top="1" Bottom="100">
         <Tooltip>SYSTEM CHECK</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes">
                                              (L:FLASH SCREENS PROGRAM, bool) ! (>L:FLASH SCREENS PROGRAM, bool)
                                              (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds)
             </Click>
      </Area>

Anyone have an idea how to properly do something like this by chance? I thought it might work. Makes sense to me that it might if the timer is running.

Bill
LHC
 

Luka

Resource contributor
Messages
212
Country
serbia
Try these corrections...

Code:
<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 16 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="111.bmp"/>
</Element>

<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == 9 12 (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - rng and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="222.bmp"/>
</Element>

<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == 4 9 (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - rng and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="333.bmp"/>
</Element>

<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == 1 4 (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - rng and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="444.bmp"/>
</Element>

<Element>
    <Select>
        <Value>
            (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 16 > and
            if{ 0 (>L:FLASH SCREENS PROGRAM, bool) }
        </Value>
    </Select>
</Element>

Code:
<Area Left="1" Right="100" Top="1" Bottom="100">
    <Tooltip>SYSTEM CHECK</Tooltip>
    <Cursor Type="Hand"/>
    <Click Repeat="Yes">
        (L:FLASH SCREENS PROGRAM, bool) ! (>L:FLASH SCREENS PROGRAM, bool)
        (P:Absolute time, seconds) (>L:FLASH SCREENS CLICK START, seconds)
    </Click>
</Area>
 
Messages
10,088
Country
us-arizona
Thanks Luka for the input and corrections. Cant believe I missed those.

Didnt work though. I tried some modifications on that system and got the last photo to appear, but oddly, only when I click on the COMMs timer click zone. That seems to link to this system some how. I tried to figure how they link, the only string they share is the P:Absolute time string and nothing else. Very odd.

This is one version I tried.

Code:
<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 16 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="111.bmp"/>
</Element>

<Element>
    <Visible>(P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 12 &lt; (L:FLASH SCREENS PROGRAM, bool) 1 == and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="222.bmp"/>
</Element>

<Element>
    <Visible>(P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 8 &lt;  (L:FLASH SCREENS PROGRAM, bool) 1 == and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="333.bmp"/>
</Element>

<Element>
    <Visible>(P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 4 &lt; (L:FLASH SCREENS PROGRAM, bool) 1 == and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="444.bmp"/>
</Element>

<Element>
    <Select>
        <Value>
            (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) 0 == and
            if{ 0 (>L:FLASH SCREENS PROGRAM, bool) }
        </Value>
    </Select>
</Element>

This one above stopped the '444.bmp' from showing up when I click the other click zone for COMMS. But now nothing works of the FLASH system.

If I section off (comment out) the other 3 strings on this section, the 111.bmp shows up, but only when I click on the COMM's click zone, which again shouldnt be related.



I must be looking at this wrong. Maybe if I create 4 separate systems and link them to a common timer.
 
Messages
10,088
Country
us-arizona
This is odd... Tried running 4 different timer systems with one click zone, and this one showed/played two of the four bitmaps, but only when you click the other COMM's timer window which has nothing in common except for P:Absolute time, seconds... Nothing else. Never seen this happen before.

FLASH SYSTEM CHECK:

Code:
<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 16 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="111.bmp"/>
</Element>

<Element>
    <Visible>(P:Absolute time, seconds) (L:FLASH SCREENS TWO CLICK START, seconds) - 12 &lt; (L:FLASH SCREENS ONE PROGRAM, bool) 1 == and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="222.bmp"/>
</Element>

<Element>
    <Visible>(P:Absolute time, seconds) (L:FLASH SCREENS THREE CLICK START, seconds) - 8 &lt;  (L:FLASH SCREENS THREE PROGRAM, bool) 1 == and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="333.bmp"/>
</Element>

<Element>
    <Visible>(P:Absolute time, seconds) (L:FLASH SCREENS FOUR CLICK START, seconds) - 4 &lt; (L:FLASH SCREENS FOUR PROGRAM, bool) 1 == and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="444.bmp"/>
</Element>

    <Element>
          (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS PROGRAM, bool) }
    </Element>

    <Element>
          (L:FLASH SCREENS TWO PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS TWO CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS TWO PROGRAM, bool) }
    </Element>

    <Element>
          (L:FLASH SCREENS THREE PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS THREE CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS THREE PROGRAM, bool) }
    </Element>

    <Element>
          (L:FLASH SCREENS FOUR PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS FOUR CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS FOUR PROGRAM, bool) }
    </Element>



Click Zone;

Code:
<Area Left="1" Right="100" Top="1" Bottom="100">
    <Tooltip>SYSTEM CHECK</Tooltip>
    <Cursor Type="Hand"/>
    <Click Repeat="Yes">
        (L:FLASH SCREENS PROGRAM, bool) ! (>L:FLASH SCREENS PROGRAM, bool)
        (P:Absolute time, seconds) (>L:FLASH SCREENS CLICK START, seconds)
        (L:FLASH SCREENS TWO PROGRAM, bool) ! (>L:FLASH SCREENS TWO PROGRAM, bool)
        (P:Absolute time, seconds) (>L:FLASH SCREENS TWO CLICK START, seconds)
        (L:FLASH SCREENS THREE PROGRAM, bool) ! (>L:FLASH SCREENS THREE PROGRAM, bool)
        (P:Absolute time, seconds) (>L:FLASH SCREENS THREE CLICK START, seconds)
        (L:FLASH SCREENS FOUR PROGRAM, bool) ! (>L:FLASH SCREENS FOUR PROGRAM, bool)
        (P:Absolute time, seconds) (>L:FLASH SCREENS FOUR CLICK START, seconds)
    </Click>
</Area>

And this is the COMMS code blocks, totally different system, but they are reacting together;

Code:
    <Element>
    <Visible> (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) - 11 &lt; and </Visible>
         <Position X="1000" Y="0"/>
       <Image Name="RadiosBackground.bmp"/>
     </Element>

    <Element>
          (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:COMMS WINDOW ACTIVE, bool) }
    </Element>

This is the COMMS click zone, which brings up the FLASH CHECK SYSTEM bitmaps;

Code:
     <!-- COMMS WINDOW //////////////////////////////////////////// -->
      <Area Left="1350" Right="1500" Top="1" Bottom="140">
         <Tooltip>COMMS CONSOLE</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> (P:Absolute time, seconds) (&gt;L:COMMS CLICK START, seconds)
                                              (L:COMMS WINDOW ACTIVE, bool) ! (>L:COMMS WINDOW ACTIVE, bool)
             </Click>
      </Area>

This shouldnt be doing that... Mystery...
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Why not simply increment the control variable every four seconds and have the corresponding image display at every step?

Code:
<Element>
   <Visible>,(L:FLASH SCREENS PROGRAM, number) 1 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="111.bmp"/>
    </Element>

   <Element>
   <Visible>(L:FLASH SCREENS PROGRAM, number) 2 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="222.bmp"/>
    </Element>

   <Element>
<Visible>(L:FLASH SCREENS PROGRAM, number) 3 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="333.bmp"/>
    </Element>

   <Element>
<Visible>(L:FLASH SCREENS PROGRAM, number) 4 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="444.bmp"/>
    </Element>

<Element>
   <Select>
       <Value>
(P:Absolute time, seconds) (G:Var1) - 4 &gt;
(L:FLASH SCREENS PROGRAM, number) 0 &gt; and
if{ (L:FLASH SCREENS PROGRAM, number) ++ 5 min (>L:FLASH SCREENS PROGRAM, number)

(P:Absolute time, seconds) (>G:Var1)
}
       </Value>
   </Select>
</Element>

Code:
    <!-- FLASH SCREENS WINDOW //////////////////////////////////////////// -->
     <Area Left="1" Right="100" Top="1" Bottom="100">
        <Tooltip>SYSTEM CHECK</Tooltip>
           <Cursor Type="Hand"/>
            <Click Repeat="Yes">
1 (>L:FLASH SCREENS PROGRAM, number)
            </Click>
     </Area>
 
Last edited:
Messages
10,088
Country
us-arizona
Thanks Bjoern. I'll try that next.

Just tried this version after finding a type (a ONE instead of a TWO label in there). This one works if you click on both click zones, lol...

Code:
<Element>
    <Visible>(L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) - 12 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="111.bmp"/>
</Element>

<Element>
    <Visible>(L:FLASH SCREENS TWO PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS TWO CLICK START, seconds) - 9 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="222.bmp"/>
</Element>

<Element>
    <Visible>(L:FLASH SCREENS THREE PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS THREE CLICK START, seconds) - 6 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="333.bmp"/>
</Element>

<Element>
    <Visible>(L:FLASH SCREENS FOUR PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS FOUR CLICK START, seconds) - 3 &lt; and</Visible>
    <Position X="300" Y="100"/>
    <Image Name="444.bmp"/>
</Element>


    <Element>
          (L:FLASH SCREENS PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS PROGRAM, bool) }
    </Element>

    <Element>
          (L:FLASH SCREENS TWO PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS TWO CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS TWO PROGRAM, bool) }
    </Element>

    <Element>
          (L:FLASH SCREENS THREE PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS THREE CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS THREE PROGRAM, bool) }
    </Element>

    <Element>
          (L:FLASH SCREENS FOUR PROGRAM, bool) 1 == (P:Absolute time, seconds) (L:FLASH SCREENS FOUR CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:FLASH SCREENS FOUR PROGRAM, bool) }
    </Element>
 
Messages
10,088
Country
us-arizona
Ok Bjoern,

Just tried yours.

The only way it works is if I click and clear (2 clicks) on the COMM's click zone (totally different circuit/code system) and then click on the FLASH SYSTEM CHECK (this system), then it plays. It plays each photo for about 1/2 second, so its all over in a blink. Actually, might be faster then 1/2 second because it seems like it goes through all four in one second. A quick blur.

Interesting direction though.
 
Messages
10,088
Country
us-arizona
It must be that the (P:Absolute time, seconds) string will trigger if its running or been run, and runs with other systems in the same gauge. Perhaps I am not shutting it down correctly.

This is the COMMS system;

Code blocks;

Code:
    <Element>
    <Visible> (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) - 11 &lt; and </Visible>
         <Position X="1000" Y="0"/>
       <Image Name="RadiosBackground.bmp"/>
     </Element>

    <Element>
          (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:COMMS WINDOW ACTIVE, bool) }
    </Element>

Click Zone;

Code:
     <!-- COMMS WINDOW //////////////////////////////////////////// -->
      <Area Left="1350" Right="1500" Top="1" Bottom="140">
         <Tooltip>COMMS CONSOLE</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> (P:Absolute time, seconds) (&gt;L:COMMS CLICK START, seconds)
                                              (L:COMMS WINDOW ACTIVE, bool) ! (>L:COMMS WINDOW ACTIVE, bool)
             </Click>
      </Area>

Something is linking to the FLASH system from this system and the only common string is P:Absolute time, seconds....
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Making multiple Visible sections in FSX and later sims can be tricky. Many people use Formatted Text statements to avoid this problem.

If this is indeed your problem, you can embed each Element section into a parent Element that only contains the Visible statement. Something like:

Code:
<Element>
       <Visible> (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) - 11 &lt; and </Visible>
    <Element>
         <Position X="1000" Y="0"/>
       <Image Name="RadiosBackground.bmp"/>
    </Element>
</Element>

I think this is right?
 
Messages
10,088
Country
us-arizona
Hey Tom,

I wonder if this is meant for the other post I have going which uses those command scripts.

In this post, I am trying to get 4 bitmap's to appear in timed order, one after the other, then resets and turns off. I cant seem to figure out how to do that.


Bill
 
Messages
10,088
Country
us-arizona
I wonder if I should be working on custom counters instead of this version of counter to keep bleed-over from happening with other Elements...
 

ddawson

Resource contributor
Messages
862
Country
canada
Code:
<Gauge Name="xml test 0" Version="1.0">
   <Image Name="0.bmp"/>

<Element>
   <Visible>(L:FLASH SCREENS PROGRAM, number) 1 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="111.bmp"/>
    </Element>

   <Element>
   <Visible>(L:FLASH SCREENS PROGRAM, number) 2 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="222.bmp"/>
    </Element>

   <Element>
<Visible>(L:FLASH SCREENS PROGRAM, number) 3 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="333.bmp"/>
    </Element>

   <Element>
<Visible>(L:FLASH SCREENS PROGRAM, number) 4 ==</Visible>
        <Position X="300" Y="100"/>
      <Image Name="444.bmp"/>
    </Element>

       <Update>
<!-- Calculate time increment-->
(P:Absolute time, seconds) (L:COMMS SECONDS PREVIOUS, seconds) - (&gt;L:COMMS SECONDS CHANGE, seconds)
(P:Absolute time, seconds) (>L:COMMS SECONDS PREVIOUS, seconds)

<!-- If gauge is active, calculate accumulated time for this segment-->
(L:COMMS WINDOW ACTIVE, bool)
    if{
    (L:COMMS SECONDS ACCUMULATED, seconds) (L:COMMS SECONDS CHANGE, seconds) + (>L:COMMS SECONDS ACCUMULATED, seconds)
    }

<!-- If 4 seconds have passed, move to the next segment-->
(L:COMMS SECONDS ACCUMULATED, seconds) 4 &gt;
    if{
    (L:FLASH SCREENS PROGRAM, number) ++ (>L:FLASH SCREENS PROGRAM, number)
    0 (>L:COMMS SECONDS ACCUMULATED, seconds)
    }

<!-- If we have displayed all four segments, shut down -->
(L:FLASH SCREENS PROGRAM, number) 4 &gt;
    if{
    0 (>L:FLASH SCREENS PROGRAM, number)
    0 (>L:COMMS WINDOW ACTIVE, bool)
    0 (>L:COMMS SECONDS ACCUMULATED, seconds)
    }
       </Update>


<Mouse>
<!-- COMMS WINDOW //////////////////////////////////////////// -->
<Tooltip>COMMS CONSOLE</Tooltip>
<Cursor Type="Hand"/>
<Click Repeat="Yes">
(L:COMMS WINDOW ACTIVE, bool) ! (>L:COMMS WINDOW ACTIVE, bool)
1 (L:COMMS WINDOW ACTIVE, bool) ==
    if{
    (P:Absolute time, seconds) (&gt;L:COMMS SECONDS NOW, seconds)
    1 (>L:FLASH SCREENS PROGRAM, number)
    }
    els{
    0 (>L:FLASH SCREENS PROGRAM, number)
    0 (>L:COMMS SECONDS ACCUMULATED, seconds)
    }
</Click>
</Mouse>


</Gauge>
I liked Bjoern's idea of a single state variable dictating which element to display. It was then a matter of calculating which element to display, based on the passage of time.
 
Last edited:

Heretic

Resource contributor
Messages
6,830
Country
germany
Ok Bjoern,

Just tried yours.

The only way it works is if I click and clear (2 clicks) on the COMM's click zone (totally different circuit/code system) and then click on the FLASH SYSTEM CHECK (this system), then it plays. It plays each photo for about 1/2 second, so its all over in a blink. Actually, might be faster then 1/2 second because it seems like it goes through all four in one second. A quick blur.

Interesting direction though.

Just saw that there's an excess space in "G:Var 1". Hence the non-working timer. (Corrected now.)

The clickspot interaction for triggering the timer is basically up to you. My example was just intended to show how this may work.
Doug's variation may be more akin to what you're looking for though.
 
Messages
10,088
Country
us-arizona
Just saw that there's an excess space in "G:Var 1". Hence the non-working timer. (Corrected now.)

The clickspot interaction for triggering the timer is basically up to you. My example was just intended to show how this may work.
Doug's variation may be more akin to what you're looking for though.

Ah so. I'll check that. It would be interesting to see how your version works.

What I do not get is how the triggers blead and shorted out, causing each to work at the same time. I looked all through my code blocks to see what might be sharing strings/scripts. The only thing they shared was P:Absolute Time. Maybe I am missing something.

I need to understand how this code works. I look at it and its a mystery as to how it works.
 
Messages
10,088
Country
us-arizona
I liked Bjoern's idea of a single state variable dictating which element to display. It was then a matter of calculating which element to display, based on the passage of time.

Doug,

I have a question for you. Usually people put the Updates at the top. You put yours under the primary code blocks. I know that code cascades downwards as its read. Did you do this for a specific reason? Its interesting and has me wondering why, or if it even makes a difference. This proves that the update section doesnt need to be at the top for it to function.

Also, when I was trying to get this to work, going through all my old gauges for parts that might be mixed into this, I found on my oldest, earliest PFD gauges, that they had multiple 'Update' sections, including Update inputs on code blocks themselves. This is done in the FS9 GPS code on our MFD where a code block has a Update setting, like 1 or 4, etc. From what I learned, you can only have 'one' Update section, right? So any and all Updates are ignored except one, and wouldnt that be the lowest Update in the cascade?



Bill
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Ah so. I'll check that. It would be interesting to see how your version works.

What I do not get is how the triggers blead and shorted out, causing each to work at the same time. I looked all through my code blocks to see what might be sharing strings/scripts. The only thing they shared was P:Absolute Time. Maybe I am missing something.

I need to understand how this code works. I look at it and its a mystery as to how it works.

P:Absolute Time is always greater than 4 (see definition in the FSX SDK documentation) and therefor, the condition is always valid (because G:Var 1 is an invalid variable name and therefor discarded) and the code within is dutifully executed every gauge update cycle.
 

ddawson

Resource contributor
Messages
862
Country
canada
Bill,
I never gave the location of the Update section a moment's thought. I am quite certain it doesn't matter.

Doug
 

ddawson

Resource contributor
Messages
862
Country
canada
On each and every gauge update, I calculate the amount of time that has passed since the last gauge update. This is unconditional, it happens all the time.

If the gauge is active, i.e. putting the numbered bitmaps on the screen, I accumulate the time that the particular bitmap has been displayed.
I do this by adding the time increment to the previous value of the accumulated time.

When this accumulated time exceeds 4 seconds, it is time to change bitmaps. I increment the FLASH SCREENS PROGRAM variable (the one controlling which bitmap is being displayed) and I reset the accumulated time variable to zero, so that the next bitmap can get its four seconds of fame.

When FLASH SCREENS PROGRAM is incremented to 5, we have displayed all the bitmaps, so it is time to quit.
At this point I reset everything to zero.

The mouse section doesn't do anything except turn the display on or off.
The line (P:Absolute time, seconds) (&gt;L:COMMS SECONDS NOW, seconds)
is a red herring which I should have taken out before I posted the code. When I first started writing timers that worked this way, I always stored the current value of the system time in a separate variable - something that is quite unnecessary, as P:Absolute Seconds works just fine.
 
Top