- Messages
- 43
- Country

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.
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.
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) (>L:PreviousTime, seconds)
1 (>L:TimerInitialized, bool)
}
(P:Absolute time, seconds) (L:PreviousTime, seconds) - (>L:TimeChange, seconds)
(L:TimeChange, seconds) 0 <
if{ 0 (>L:TimeChange, seconds) } <!-- In case Absolute time has reset -->
(L:SystemButtons, bool) 1 ==
if{
(L:AccumulatedTime, seconds) (L:TimeChange, seconds) + (>L:AccumulatedTime, seconds)
(L:AccumulatedTime, seconds) 0 >
(L:AccumulatedTime, seconds) 5 <
(L:AccumulatedTime, seconds) 5 >
if{
0 (>L:AccumulatedTime, seconds)
}
}
Last edited:
