Sign in to follow this  
spokes2112

delay in a XML function

Recommended Posts

HiHow can I in XML build in a delay for a function.E.g. when I start the APU, I want to have a delay of, say, 5 seconds before I see the effect: "RUN" or "Power available"(No needle's etc)Thanksphjvh

Share this post


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

Assume you have a switch or button to initialize a variable.. (G:Var1)OFF = 0Start = 1Running = 2(G:Var1) 1 == if{ (P:Local Time, seconds) 6 % int 5 == if{ 2 (>G:Var1) } } (P:Local Time, seconds) 6 % int 5 == takes the local time, % divides time by 6 and gives the remainder as an integer, when the remainder = 5 it will toggle (G:Var1) to 2.. ( running )(P:Local Time, seconds) 6 % int 5 == or something similar is useful for things such as blinking displays. etc..Hope it helps... Regards,RomanProject 737-400Note, the way it looks here on the forum is different since HTML has processed it. On paper the " < " would be " & l t ; " , the " > " would be " & g t ; " and the " & " would be " & a m p ; ". All without the quotes and remove spaces between characters.

Share this post


Link to post
Share on other sites

Hi,Thanks for your work, but it didn't work out.Here are the gauges:1. this is the APU switch:(L:Battery Mode,bool) 1 == if{ (A:Electrical master battery,bool) } els{ (L:Dummy5, bool) }APU Main Switch(L:Battery Mode,bool) if{ 0 (>K:TOGGLE_MASTER_BATTERY) 1 (>K:TOGGLE_AFTERBURNER1) } els{ 0 (L:Dummy5, bool) ! (>L:Dummy5, bool) 1 (>K:TOGGLE_AFTERBURNER1) }2. the next one shows up when I press the switch and I want it to happen some 5 seconds later:(A:Electrical master battery,bool) (L:Battery Mode,bool) && I Hope you can help me.phjvh

Share this post


Link to post
Share on other sites

Sorry, but I donot understand the part of L:Dummy,bool.. So here is an example (not tested) using your L:battery mode which I assume is the state of battery bus. The light has been incorporated to the whole APU panel. Also in this code you need to provide a backround. When the APU is on the master battery is on, when the APU is off so is the FS battery, the engines should provide power through the gen busses and the L:Battery mode could keep power to the gauges tied to the Batt. buss. Also there is a 3rd bitmap for the start position. If L:Batt mode is off, and the APU is in start, or run and not running, it will return to OFF. (G:Var1)0 == off1 == run position not running2 == run position running3 == start position(G:Var2) Timer(P:Local Time, seconds) + 0.65 or 12 running. (***** section to turn off/on FS battery buss **** )(G:Var1) 2 == if{ (A:Electrical master battery,bool) 0 == if{ (>K:TOGGLE_MASTER_BATTERY) } } els{ (A:Electrical master battery,bool) 1 == if{ (>K:TOGGLE_MASTER_BATTERY) } }(********* Start position, return to run 0.65 sec. delay *******)(G:Var1) 3 == if{ (P:Local Time, seconds) (G:Var2) > if{ 1 (>G:Var1) + (P:Local Time, seconds) 12 + (>G:Var2) } }(********* Run position, timer starts ( 12 secs. before running) *******)(G:Var1) 1 == if{ (P:Local Time, seconds) (G:Var2) > if{ 2 (>G:Var1) } }(********* Knob bitmaps *******)(G:Var1) s1 0 == l1 3 == || if{ l1 } els{ 1 }(********* Start or run, APU not running and L:Batt mode turned off *******)(G:Var1) s1 3 == l1 1 == || (L:Battery Mode,bool) 0 == & if{ 0 (>G:Var1) }(********* ON bitmap *******)(G:Var1) 2 ==APU Main Switch(G:Var1) 0 == if{ 3 (>G:Var1) + (P:Local Time, seconds) 0.65 + (>G:Var2) } els{ 0 (>G:Var1) }This one is different than the first reply. The 1st code is flawed because it was dependant on actual time not the difference in time. On major problem is if the APU is turned to start at 23:59:47 or later local time, or FS is paused, the gauge will get stuck. Still haven't found a way 'round this. Regards,RomanProject 737-400Note, the way it looks here on the forum is different since HTML has processed it. On paper the " < " would be " & l t ; " , the " > " would be " & g t ; " and the " & " would be " & a m p ; ". All without the quotes and remove spaces between characters.

Share this post


Link to post
Share on other sites

Hi,What an effort!!Unfortunately FS2002 crashes, when I use the gauge...Still puzzling.Is it possible, as a start, for you, to make a dummy and test it somehow?Say, a switch, only on and off, with as result a light going off and on with "the delay" build in?I,m curiousphjvh

Share this post


Link to post
Share on other sites

Hi Romas,As phjvh's APU is from my ARJ and BAe146 Panel, I would be also interested in a functionally Delay :-) Is it possible to post the result here? I need it for a new Gauge, not an update of the ARJ PanelBest RegardsMatthias

Share this post


Link to post
Share on other sites

Hi,Mailed already a grateful thanks to Roman.It works very fine.And Matthias, also thanks for your work and solution for the APU problem in MSFS.I was able to incorporate it in the 767-300 overhead panel.Greetingsphjvh

Share this post


Link to post
Share on other sites

Hi phjvh,I'm happy that you find the Gauge useful. However I'm still interested in the delay. I hope someone could post it here in the forum.Best regardsMatthias

Share this post


Link to post
Share on other sites

Hi all,Here is Roman's code, with indication to my bitmaps.In the mean time I changed the code, to incorporate it in the main electrical gauge of the overhead panel, see pic.(***** section to turn off/on FS battery buss **** )(G:Var1) 2 == if{ (A:Electrical master battery,bool) 0 == if{ (>K:TOGGLE_MASTER_BATTERY) } } els{ (A:Electrical master battery,bool) 1 == if{ (>K:TOGGLE_MASTER_BATTERY) } }(********* Start position, return to run 0.65 sec. delay *******)(G:Var1) 3 == if{ (P:Local Time, seconds) (G:Var2) > if{ 1 (>G:Var1) + (P:Local Time, seconds) 12 + (>G:Var2) } }(********* Run position, timer starts ( 12 secs. before running) *******)(G:Var1) 1 == if{ (P:Local Time, seconds) (G:Var2) > if{ 2 (>G:Var1) } }(********* Knob bitmaps *******)(G:Var1) s1 0 == l1 3 == || if{ l1 } els{ 1 }(********* Start or run, APU not running and L:Batt mode turned off *******)(G:Var1) s1 3 == l1 1 == || (L:Battery Mode,bool) 0 == & if{ 0 (>G:Var1) }(********* ON bitmap *******)(G:Var1) 2 ==APU Main Switch(G:Var1) 0 == if{ 3 (>G:Var1) + (P:Local Time, seconds) 0.65 + (>G:Var2) } els{ 0 (>G:Var1) }phjvh

Share this post


Link to post
Share on other sites

Hi phjvh, Roman and Eugen,Great, thank you very much. The code is very useful.Best regardsMatthias

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this