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

Visibility Timer Help

Messages
153
Country
us-california
I am in need of a little help or clarification of what i'm doing wrong.

I have a switch that turns on my power to my tank controller. When the switch is flipped on there are a set of lights that come on for 1 second and then turn off.

I am using this code but it delays the lights shutting off not coming on. I know I am missing something simple but haven't been able to work it out yet.

Code:
                    (L:s2t_tank_power_switch, bool) 
                    if{ (E:ABSOLUTE TIME, Seconds) 1 + (>L:LED_TIMER4,Enum) }
                    (L:LED_TIMER4,Enum) (E:ABSOLUTE TIME, Seconds) >
 
If I understand your logic, all the time the power switch variable is true you are constantly adding 1 second to the LED_TIMER4 variable, so that variable is never less than the absolute time. You must use code that adds one second to the LED variable and then *never does it again*.
 
Hi Tom thank you for the reply. I am still very new in XML coding. Is there any hint you can offer to help me out on how to get started on that?
 
Here is some code I modified from my gauges. The first Element starts the timer by setting the LED_TIMER4_FLAG to 1. The second Element triggers the action and resets the flag to 0. Not tested.

XML:
    <Element> <!-- Set flag to start timer -->
      <Select>
        <Value> (L:s2t_tank_power_switch, bool) (L:LED_TIMER4_FLAG, enum) 0 == &amp;&amp;  if{ (E:ABSOLUTE TIME, Seconds) 1 + (>L:LED_TIMER4,enum) 1 (>L:LED_TIMER4_FLAG, enum)} </Value>
      </Select>
   </Element> 

    <Element> <!-- One second has elapsed, do the action and reset the flag -->
        <Value> (L:LED_TIMER4,Enum) (E:ABSOLUTE TIME, Seconds) > (L:LED_TIMER4_FLAG, enum) 1 == &amp;&amp;  if{ [PLACE ACTION CODE HERE] 0 (>L:LED_TIMER4_FLAG, enum)} </Value>
      </Select>
   </Element>

There are probably simpler ways to do this, but I never remember them. :)
 
Thank you for the help. I am going to go try it. Just a question if I am sticking this in a visibility for the tank power lights would the action code not be needed? just reset the flag?
 
In that case you don't need the Action section, you can use the (L:LED_TIMER4_FLAG, enum) variable in the visibility section . It is TRUE (1) when needed (visible) and FALSE (0) when not (invisible).
 
Last edited:
Thanks for your help. I couldnt get it to work that way but made a work around with a visibility and an animation to make it disappear. Works perfectly now.
 
Back
Top