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

Timed visibility code

Messages
549
Country
nicaragua
Hi again!
I wanted to make an object disappear after say 5 seconds after I clicked on a switch!

Is a simple visibility code enough for this or there's more to it?

Thanks!
 
You save the current time into an L: variable. Then check when the current time < your L: variable + 5 minutes. When this is true, activate your visibility code. If not possible in model XML code, create a gauge to do it.

Hope this helps,
 
In the mouse click section:

(E:LOCAL TIME, seconds) 5 + (>L:MyTimer,enum)

In the <Visible> section:

(L:MyTimer,enum) (E:LOCAL TIME, seconds) &lt;
 
If you want to keep from having more gauge draws you can simply have
the tanks last animation keyframe move the tank to an area hidden in the
aircraft. i use this method to keep it simple and less draws!

Gives the exact same result....

DG:eek:
 
Last edited:
While said with tounge in cheek one might opt to put a bone on each side of the tank and flatten it in the last frame so it can fit in the smallest of spaces.

Or not ...
 
Which mean bones animation!!! i had to read that twice to get what you were
saying Chuck...But i would stay with a visibility because bones can run into trouble with high poly parts and cause more draw than the visibility gauge would!

DG:rolleyes:
 
BTW, how can I make the animation only run once? Can I add an "enum" variable to the switch and make it change from "x" to "y" when you press the button while the animation only runs when the enum is exactly "x"?
 
Yes, add another L: variable that goes from 0 to 1 when the tanks are dropped. Then make a condition of dropping that the L: variable = 0.
 
There's an issue: When I click the button the object disappears and then reapears after the 5 seconds. I wanted it to disappear after 5 secs. I've tried everything. If I put &gt instead of the &lt the object doesn't even appear. I tried to make a diference between the custom var and FS time var and make the condition work only when that difference is smaller than 5 secs, but no luck...
 
There's an issue: When I click the button the object disappears and then reapears after the 5 seconds. I wanted it to disappear after 5 secs. I've tried everything. If I put &gt instead of the &lt the object doesn't even appear. I tried to make a diference between the custom var and FS time var and make the condition work only when that difference is smaller than 5 secs, but no luck...

I'd have to see your actual script. Who knows what might possibly be bass-ackwards!

Lord knows I've managed to screw up "simple stuff" more than once myself... :rotfl:
 
Code:
<Animation name="droptank_switch" guid="548aabdb-2431-4e3f-9a17-0636ac2a8185" type="Sim" typeParam="AutoPlay" length="100" typeParam2="droptank_switch" />



<PartInfo>
<Name>droptank_switch</Name>
<AnimLength>50</AnimLength>  
<Animation>
<Parameter>
<Code>
        (L:drop, bool) 50 *
</Code>

</Parameter>

</Animation>
<MouseRect>
      <Cursor>Hand</Cursor>
         <TooltipText>Drop external fuel tanks</TooltipText>
         <CallbackCode>
              	(L:drop,bool) ! (&gt;L:drop,bool)
		(E:LOCAL TIME, seconds) 2 + (>L:droptime,enum)
	</CallbackCode>
</MouseRect>
</PartInfo>

//tank visiblity

 <PartInfo>
    <Name>tank_vis</Name>
    <Visibility>
      <Parameter>
        <Code>
        (L:droptime,enum) (E:LOCAL TIME, seconds) &lt;

	</Code>
      </Parameter>
    </Visibility>
  </PartInfo>

//Drop animation

<Animation name="tankdrop" guid="19e0cea3-a2c7-4a4c-b6bd-8aba05a5fca4" type="Sim" typeParam="AutoPlay" length="100" typeParam2="tankdrop" />

<PartInfo>
    <Name>tankdrop</Name>
   <AnimLength>100</AnimLength>  
<Animation>
<Parameter>
<Code>
(L:drop,bool)
if{ 100 }
els{ 0 }
</Code>
<Lag>50</Lag>
</Parameter>
</Animation>
</PartInfo>

The weird thing is, when I use the code like that, the tanks are visible before I press the button. Turn invisible after I press it and then come back to sight 2 secons later...
 
You need to add the (L:drop,bool) condition to the script:

Code:
<PartInfo>
  <Name>tank_vis</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:drop,bool) !
        if{ 1 }
        els{ 
          (L:droptime,enum) (E:LOCAL TIME, seconds) &lt;
          if{ 1 }
          els{ 0 }
          }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>
 
Ah, ok, thanks! :D
Didn't know that was necessary since I made it only for the animation...
 
Thats cool. So putting in the if 1 then 'animation' then if 1, then zero, will cause it to not function again.

Nice....!
 
Thats cool. So putting in the if 1 then 'animation' then if 1, then zero, will cause it to not function again.

Nice....!

<Visibility> scripts always evaluate to either 1 or 0 (TRUE or FALSE).

If TRUE, then the part will be seen; else it is hidden from view.

If you evaluate the script I provided, the part will only be visible when both conditions are true:

1. the switch (L:drop, bool) equals 1 (i.e., is TRUE)
and
2. the timer remains TRUE

otherwise (else) the <Visibility> returns zero (0).
 
Back
Top