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

FSXA Visibility Timer

Messages
43
Country
us-ohio
I am making a 2d gauge that I need to have an element show up briefly and then disappear when a button is clicked.

This is the first extensive gauge I have ever created so my knowledge on the coding is lacking. I have been able so far to find posts here that covered everything I wanted to do. This one is escaping me.

The element should display when the L variable = 1.

When the button is pressed the L variable should be changed to a 1, a timer should start that changes L variable back to a 0 after 5 seconds.

I am using the notepad ++ and the Aces tool to set up the gauge just for referance.

Code:
           <Element id="Button01">
                <FloatPosition>231.000,552.000</FloatPosition>
                <Visibility>(L:Buttons01, number) 1 ==</Visibility>
                <Image id="s3-9.bmp" Name="s3-9.bmp">
                    <Transparent>True</Transparent>
                    <Bright>True</Bright>
                </Image>
            </Element>

            <MouseArea id="Button 01">
                <FloatPosition>292.000,100.000</FloatPosition>
                <Size>10,60</Size>
                <CursorType>UpArrow</CursorType>
                <Tooltip id="Tooltip">
                    <DefaultScript>Button 01</DefaultScript>
                </Tooltip>
                <MouseClick id="MouseClick">
                    <Script>{see below}
					</Script>
                    <ClickType>LeftSingle</ClickType>
                </MouseClick>
            </MouseArea>

I found this code by DDawson on this page and I tried using parts of it do what I want but of course it is failing to work.

http://www.fsdeveloper.com/forum/showpost.php?p=243605&postcount=5

I know the code is wrong and I also know I am not sure what to do with it from here to make it work.

I would be very grateful with some guidance on how to accomplish this task.

Code:
(L:TimerInitialized, bool) !
if{
<!-- Previous time has to start out equal to current time -->
(P:Absolute time, seconds) (&gt;L:PreviousTime, seconds) 
1 (&gt;L:TimerInitialized, bool)
}

(P:Absolute time, seconds) (L:PreviousTime, seconds) - (&gt;L:TimeChange, seconds)
(L:TimeChange, seconds) 0 &lt;
if{ 0 (&gt;L:TimeChange, seconds) }  <!-- In case Absolute time has reset -->

(L:SystemButtons, bool) 1 ==
if{
(L:AccumulatedTime, seconds) (L:TimeChange, seconds) + (&gt;L:AccumulatedTime, seconds)

(L:AccumulatedTime, seconds) 0 &gt;
(L:AccumulatedTime, seconds) 5 &lt;

(L:AccumulatedTime, seconds) 5 &gt;
if{
0 (&gt;L:AccumulatedTime, seconds)
}
}
 
Last edited:
This would be a simple method:

Code:
           <Element id="Button01">
                <FloatPosition>231.000,552.000</FloatPosition>
                <Visibility>(P:Absolute time, seconds) (L:PreviousTime, seconds) - 5 &lt; if{ 1 (>L:Buttons01, number) } els{ 0 (>L:Buttons01, number) } (L:Buttons01, number) 1 ==</Visibility>
                <Image id="s3-9.bmp" Name="s3-9.bmp">
                    <Transparent>True</Transparent>
                    <Bright>True</Bright>
                </Image>
            </Element>

            <MouseArea id="Button 01">
                <FloatPosition>292.000,100.000</FloatPosition>
                <Size>10,60</Size>
                <CursorType>UpArrow</CursorType>
                <Tooltip id="Tooltip">
                    <DefaultScript>Button 01</DefaultScript>
                </Tooltip>
                <MouseClick id="MouseClick">
                    <Script>(P:Absolute time, seconds) (>L:PreviousTime, seconds)</Script>
                    <ClickType>LeftSingle</ClickType>
                </MouseClick>
            </MouseArea>


And if you don't really need (L:Buttons01, number) in other part of your code, this would be a simplified version:

Code:
           <Element id="Button01">
                <FloatPosition>231.000,552.000</FloatPosition>
                <Visibility>(P:Absolute time, seconds) (L:PreviousTime, seconds) - 5 &lt;</Visibility>
                <Image id="s3-9.bmp" Name="s3-9.bmp">
                    <Transparent>True</Transparent>
                    <Bright>True</Bright>
                </Image>
            </Element>

            <MouseArea id="Button 01">
                <FloatPosition>292.000,100.000</FloatPosition>
                <Size>10,60</Size>
                <CursorType>UpArrow</CursorType>
                <Tooltip id="Tooltip">
                    <DefaultScript>Button 01</DefaultScript>
                </Tooltip>
                <MouseClick id="MouseClick">
                    <Script>(P:Absolute time, seconds) (>L:PreviousTime, seconds)</Script>
                    <ClickType>LeftSingle</ClickType>
                </MouseClick>
            </MouseArea>

Hope this helps,

Tom
 
Back
Top