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

Timer / Visibility Code

Messages
10,163
Country
us-arizona
Hey all,

How would one write a code for a part to 'appear' when the engine has been cut off for 20 seconds?

What I wish to do is have the composite prop cover mittens to 'appear' 20 seconds after you shut the engine down.

Many thanks,

Bill
LHC
 
“What I wish to do is have the composite prop cover mittens to 'appear' 20 seconds after you shut the engine down”

Try this for your "prop cover mittens" part Bill:

Code:
<part> 
 <name>prop_cover</name>
  <visible_in_range>
   <parameter>
    <code>(L:prop_cover,enum) 1 ==</code>
   </parameter>
    <minvalue>1</minvalue>
   </visible_in_range>
</part>

And use this control code in an "invisible" 2D gauge:

Code:
<Gauge Name="prop cover" Version="1.0">
 <Update Frequency="6"/>

<Element>
    <Select>
      <Value>(A:SIM ON GROUND, bool) 1 == (A:General eng rpm:1,RPM) 0 == &amp;&amp; if{ (G:Var1) 0 == if{ 1 (&gt;G:Var1) (P:Local Time, seconds) 20 + 

(&gt;G:Var2) } } els{ (G:Var1) 0 &gt; if{ 0 (&gt;G:Var1) } }
      </Value>
    </Select>
 </Element>

  <Element>
    <Select>
      <Value>(G:Var1) 1 == if{ (P:Local Time, seconds) (G:Var2) &gt; if{ 1 (&gt;G:Var3) } }
      </Value>
    </Select>
 </Element>

  <Element>
    <Select>
      <Value>(G:Var3) 1 == if{ (L:prop_cover,enum) 0 == if{ 1 (&gt;L:prop_cover,enum) } } els{ (L:prop_cover,enum) 1 == if{ 0 (&gt;L:prop_cover,enum) } } 
      </Value>
    </Select>
 </Element>

</Gauge>

I just tested all of the above and it works just fine.:)
 
I should've added this to my first post, but I was in a hurry this morning.

This is versatile code, and can be used for a variety of things, just by changing the conditions that start the timer. And if you want to change the time interval before the part(s) display, or events of your choosing occur, then, “(P:Local Time, seconds) 20 +” is the variable you want. Just change the value “20” to whatever you need.

Code:
<Element>
    <Select>
      <Value>(A:SIM ON GROUND, bool) 1 == (A:General eng rpm:1,RPM) 0 == &amp;&amp; if{ (G:Var1) 0 == if{ 1 (&gt;G:Var1) [B](P:Local Time, seconds) 20[/B] + (&gt;G:Var2) } } els{ (G:Var1) 0 &gt; if{ 0 (&gt;G:Var1) } }
      </Value>
    </Select>
 </Element>
 
Back
Top