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

FS2004 Delay Problem

Messages
1,468
Country
italy
I'm sorry chaps, but yet again I'm having a problem with (P:local time,seconds).

The intention is to inhibit the light on for a period of time. Here are the two codes that set it up. The second being the lamp. The part of interest is in red. The problem is that (L:gear_delay,number) continues to count so will never be less than (P:local time, seconds). I can't see what's wrong as surely (L:gear_delay,number) should receive a single value and stay there until exceeded by (P:local time, seconds).
I have many other instances of this and they all work so I can't see what's wrong this time! (L:gear_delay,number) starts off as zero and stays there until the first code's conditions are met but instead of a single value it continues to count.

Code:
<Element>
      <Select>
         <Value>(L:gear_cycled2,bool) 1 == (A:Gear handle position,percent) 50 &gt; and [COLOR="Red"]if{ (P:local time, seconds) 30.00 + (>L:gear_delay,number) }[/COLOR]</Value>
      </Select>
   </Element>

Code:
<Value>(A:Gear center position,percent) 90 &gt; (L:filament_burnt_out,number) 0 == and (L:BUS_SWITCH,number) (P:local time, seconds) &lt; and [COLOR="Red"](L:gear_delay,number) (P:local time, seconds) &lt; and[/COLOR] </Value>
 
Last edited:
Hi,

You can add another variable which starts at 0. In the first code test for this variable to equal 0. Then in the if{ section set it to 1. That way the first section of code will only run once. Then in another line of code, set this new variable back to 0 when those two conditions are NOT met and the new variable equals 1.

Hope this helps,
 
Um, the problem is that you are assigning this every gauge cycle:

(P:local time, seconds) 30.00 + (>L:gear_delay,number)

Then you're testing this every gauge cycle:

(L:gear_delay,number) (P:local time, seconds) &lt;

It should be obvious that (L:gear_delay,number) is always going to be updated every cycle with (P:local time, seconds)...

...so the condition you're testing for will never be true! :o

BTW #1, I managed to foul myself up on this very same thing a couple of days ago... :rotfl:

BTW #2, that is an Environment variable, so it should be "E:" and not "P:"...

Something like this will only work in a mouse click area so it will only get set once:

(P:local time, seconds) 30.00 + (>L:gear_delay,number)

Another way to set up a timer is to simply "count" to x number of cycles. So, 18 x 30 seconds = 540:

Code:
(L:TimerDelay,enum) ++ 540 min 0 max (>L:TimerDelay,enum)
(L:TimerDelay,enum) 540 ==
if{ 1 (>L:TimerExpired,bool) }
els{ 0 (>L:TimerExpired,bool) }
 
Thanks Tom and Bill,
I was about 90% there!! Also I realised whilst sweating in bed last night (it was 30c until 1am here last night!) that I had to apply the control twice. The first time tests that the gear has been raised. To account for engine fire on take-off and then of course I had to test that the gear had been lowered for landing. There were therefore two conditions not one.
Thanks again.
vololiberista
 
It's amazing how a simple code like a timer can give so much headaches... :D

A couple of advises:

1) Use (P:Absolute time,seconds) always (E: also works) instead of local or GMT time to avoid the midnight shift.

2) If you use a counter like the one Bill suggests (and I second), don't forget to apply the current sim rate correction!:

Code:
(L:TimerDelay,enum)  1  (P:Simulation Rate, number)  * + 540 min 0 max (>L:TimerDelay,enum)

Tom
 
It's amazing how a simple code like a timer can give so much headaches... :D

A couple of advises:

1) Use (P:Absolute time,seconds) always (E: also works) instead of local or GMT time to avoid the midnight shift.

Interesting that P: works, given that the FSX SDK is quite explicit:
Environment Data
This data is referenced by E: in XML gauges.

In any case, I had to create a couple dozen scripts to "auto-dim" some blue indicator lights after they'd been on for ~5 seconds. Since these indicator lights are 3d, instead of using a "gauge" I created the FSX Material with a normal .dds bitmap for the indicator lights, but applied a $VC_ to the Self-Illumination Slot, with 'Additive' chosen as the Emissive Mode.

I created a 24bit version of the .dds texture and use it as the "gauge" background.

This allowed me to create a series of vector drawn semi-opaque boxes over various parts of the texture to "dim" those selections individually... :D

Here is a brief example for one such blue indicator light:
Code:
<Gauge Name="AnnunciatorLts2" Version="1.0">
   <Element>
      <Select>
         <Image Name="AnnunLights_dimming2.bmp"/>
      </Select>
   </Element>

  <Update>
    <!-- AUTODIM VALVE CROSSFEED OPEN LIGHT -->
    (L:B737_Knob_Crossfeed,bool)
    (L:B737_FLT_CTRL_Test,bool) or
    if{ (L:ValveOpenDelayCF,enum) ++ 90 min 0 max (>L:ValveOpenDelayCF,enum) }
    els{ 0 (>L:ValveOpenDelayCF,enum) }
  </Update>

  <!-- VALVE CROSSFEED OPEN LIGHT -->
  <Element>
    <Visible>
      (L:ValveOpenDelayCF,enum) 90 ==
    </Visible>
    <Position X="90" Y="118"/>
    <Rectangle Width="88" Height="43" FillColor="black" Transparency="0.4"/>
  </Element>

</Gauge>
This allows the chosen light to come on at full brightness, then "auto-dim" ~5 seconds later. It will auto-reset every time the light is extinguished.

And yeah, I could have probably made it more simple by dropping the "logic" into the <Visibility> tag area... ;)
 
Thanks again Tom and Bill. In fact you have given me an idea as to how to dim some lights on the engineer's panel.
As for the other stuff that's all working nicely now.
Thanks
Vololiberista
 
Back
Top