Archived

This topic is now archived and is closed to further replies.

tmc74

XML Code for timer function needed

Recommended Posts

Hello,

 

I´m lookin for a simply XML Code wich activate the Function TOGGLE_BEACON_LIGHTS for exactly 2 or 3 seconds, everytime when i press a Key or Button(just short press and release). Key/Button is programmed with FSUIPC.

 

regards,

Thomas

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Thomas,

 

This "should" work, as there is alot more involved.

 

1. Any time the trapping would work is when at least 1 of the gauges is visible = does not work in spot/tower view

2. FS9 or FSX , both?

3. Is this for a gun/ weapon? What? The way I have it coded now is that it is not repeatable, meaning you cannot restart the timer until the last triggered timer = 0 (This could be changed, notes in code)

4. 2 versions, a "Master" must be used in the VC if the aircraft has one, otherwise in the main panel window. A "Slave", can be used in any other 2d window when the other 2d window is open but the VC (or main) is not visible.

5. This gauge needs a small bitmap, 10 x 10 with a color of 0,0,0 would do it. named Blank.bmp

6. In FSUIPC use TOGGLE BEACON LIGHTS for your key/button programming.

 

The master gauge..

 

<Gauge Name="BEACON_TIMER_MASTER" Version="1.0">
<Image Name="Blank.bmp"/>
<Update Frequency="18">
(L:Beacon_Timer, number) 0 != if{ (L:Beacon_Timer, number) -- (>L:Beacon_Timer, number) }
(L:Beacon_Timer, number) 1 > (A:LIGHT BEACON, bool) ! and if{ (>K:TOGGLE_BEACON_LIGHTS) }
<!-- The beacon turns off when the timer = 1, this is done so a repeatable trigger could be used -->
(L:Beacon_Timer, number) 1 == (A:LIGHT BEACON, bool) and if{ (>K:TOGGLE_BEACON_LIGHTS) }
</Update>

<!-- Note the timer is base 18,,, 18=1 sec, 36=2 sec 54=3 sec etc.. -->

<Keys>
<!-- The repeatable code
<On Event="TOGGLE_BEACON_LIGHTS">(L:Beacon_Timer, number) 1 != if{ 45 (>L:Beacon_Timer, number) }</On> -->
<!-- The non repeatable code -->
<On Event="TOGGLE_BEACON_LIGHTS">(L:Beacon_Timer, number) 0 == if{ 45 (>L:Beacon_Timer, number) }</On>
</Keys>

</Gauge>

 

 

The slave gauge..

 

<Gauge Name="BEACON_TIMER_SLAVE" Version="1.0">
<Image Name="Blank.bmp"/>

<!-- Note the timer is base 18,,, 18=1 sec, 36=2 sec 54=3 sec etc.. -->
<Keys>
<!-- The repeatable code
<On Event="TOGGLE_BEACON_LIGHTS">(L:Beacon_Timer, number) 1 != if{ 45 (>L:Beacon_Timer, number) }</On> -->
<!-- The non repeatable code -->
<On Event="TOGGLE_BEACON_LIGHTS">(L:Beacon_Timer, number) 0 == if{ 45 (>L:Beacon_Timer, number) }</On>
</Keys>

</Gauge>

 

This is not tested, but based highly (95%) on known working code that I have.

 

Roman

Share this post


Link to post
Share on other sites

Hi Roman,

 

Thank you so much !

That works fine !

I´d never could do this alone, more code lines that i thought.

 

Sorry, forgot to mention, its for fs9

Yes for Weapon Effect, rocket smoke tail simulation

Yes must be repeatable.

 

I found out, to adjust the Time i must change the Entry in the "On Event" Section of the Master, default of yours ist 45.

 

best regards,

Thomas

Share this post


Link to post
Share on other sites

Thomas,

 

Glad it worked for your application.. Yes the number ( 45 in the example = 2.5 seconds ) should be changed to your liking. The number needed in code = seconds needed * 18 rounded to nearest whole number. Be sure to change the slave number too, if used.

 

Roman

Share this post


Link to post
Share on other sites