Jump to content
Sign in to follow this  
Guest dirk1000

Help wanted with delay code for a XML gauge

Recommended Posts

Hi, You can build in a timer.May be this one works:(A:general eng2 propeller lever position,part) 0.04 + 0.75 > if{ (P:Absolute Time, seconds) 5 + (>L:timer,number) (G:Var1) 0 == if{ 1 (>G:Var1) 1 (>L:dsd_xml_sound_id_20,number) } } els{ 0 (>G:Var1) }(A:general eng2 propeller lever position,part) 0.04 + 0.90 < if{ (G:Var3) 0 == (P:Absolute Time, seconds) (L:timer,number) > and if{ 1 (>G:Var3) 0 (>L:dsd_xml_sound_id_20,number) 1 (>L:dsd_xml_sound_id_21,number) } } els{ 0 (>G:Var3) }Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Hi Dirk,If your problem is that one sound should be started when another is completed, you can solve that much simpler.If you start a sound (single shot) by setting the appropriate variable to "1", Dougs XMLsound gauge will set that variable back to "0" if the sound has completed playing. So just test for that.It's easier, and will even work OK if you decide to change the soundfiles (and duration) without the need to change the timer in the XML code.Cheers, Rob

Share this post


Link to post
Share on other sites
Guest dirk1000

Hi Jan, Thanks for your help.This is jus what I was looking for.I will try your code and comment.Kind Regards.Dirk Trotteyn (SANT)

Share this post


Link to post
Share on other sites
Guest dirk1000

Hi Rob,Thanks for your help.What I

Share this post


Link to post
Share on other sites
Guest dirk1000

Hi Jan, I tested your timer code. Needed change the position of '(P:Absolute Time,seconds) 5 + (>L:timer,number)', coz it was outside the (G:Var1).. 'do it once' control, and the L:timer was continued updated (in the first tag).--- (A:general eng2 propeller lever position,part) 0.04 + 0.75 > if{ (G:Var1) 0 == if{ (P:Absolute Time, seconds) 5 + (>L:timer,number) 1 (>G:Var1) 1 (>L:dsd_xml_sound_id_20,number) } } els{ 0 (>G:Var1) }------(A:general eng2 propeller lever position,part) 0.04 + 0.90 > if{ (G:Var2) 0 == (P:Absolute Time, seconds) (L:timer,number) > && if{ 1 (>G:Var2) 2 (>L:dsd_xml_sound_id_21,number) 0 (>L:dsd_xml_sound_id_20,number) } } els{ 0 (>G:Var2) }---This works OK! And do what I need to do in my gauge.Thanks again for your help and for your time.Kind Regards.Dirk Trotteyn (SANT)

Share this post


Link to post
Share on other sites
Guest taipan_daz

This topic appears to have been dead for a while but is exactly what I am trying to implement in my MFD.I am trying to build in the Built-In-Test function, which requires the MFD to scroll through 8 coloured screens at 1 sec intervals, then the last screen is shown for 2 seconds then returns to the original page.I am happy with setting up variables etc for it, but I am wondering if anyone can offer any light on an easy way to cycle through the images. I am NOT sure of how to use Update cycles yet - I am getting there slowly though.Thanks in advance guys.taipan

Share this post


Link to post
Share on other sites

Hi,You could experiment with:(G:Var1) 0 == if{ (P:Absolute time,seconds) 2 + (>G:Var2) 1 (>G:Var1) } (G:Var1) 1 == (P:Absolute time,seconds) (G:Var2) > and if{ (P:Absolute time,seconds) 2 + (>G:Var2) 2 (>G:Var1) } (G:Var1) 2 == (P:Absolute time,seconds) (G:Var2) > and if{ (P:Absolute time,seconds) 2 + (>G:Var2) 3 (>G:Var1) } (G:Var1) 3 == (P:Absolute time,seconds) (G:Var2) > and if{ (P:Absolute time,seconds) 2 + (>G:Var2) 4 (>G:Var1) } (G:Var1) 4 == (P:Absolute time,seconds) (G:Var2) > and if{ 5 (>G:Var1) } etc. etc.(G:Var1)etc. etc.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest taipan_daz

Thanks Jan,I'll give it a go and get back to you with the results.Cheers.taipan

Share this post


Link to post
Share on other sites
Guest taipan_daz

Jan, no joy mate.If I tried to use an block here, would it simply be a case of removing the and and replacing with ?? Can I set a speed using Frequency=" " ??Cheers for your time.

Share this post


Link to post
Share on other sites

You could try:(G:Var1) 0 == if{ (P:Absolute time,seconds) 2 + (>G:Var2) 1 (>G:Var1) } (G:Var1) 1 == (P:Absolute time,seconds) (G:Var2) > and if{ (P:Absolute time,seconds) 2 + (>G:Var2) 2 (>G:Var1) } (G:Var1) 2 == (P:Absolute time,seconds) (G:Var2) > and if{ (P:Absolute time,seconds) 2 + (>G:Var2) 3 (>G:Var1) } (G:Var1) 3 == (P:Absolute time,seconds) (G:Var2) > and if{ (P:Absolute time,seconds) 2 + (>G:Var2) 4 (>G:Var1) } etc. etc.somewhere back to 0!(G:Var1)etc. etc.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest taipan_daz

Hi Jan,This works, but only displays the first image. I can't be sure, but I don't think the gauge is even acknowledging the block, and it is just going straight to the block for (G:Var8) = 0.Here is my code. The first is the overarching page in the MFD, the next one is the MFD background for the Built In Test page, and the next Element, which we are dealing with, it for the MFD test function, which is activated using the L varb (L:Lbit_MFD, bool) being 1.Any thoughts? I am probably doing something obviously wrong!(L:Lpage_select, enum) 1100 >= (L:Lpage_select, enum) 1199 <= &&(L:Lbit_MFD, bool) 0 ==(L:Lbit_MFD, bool) 1 ==(G:Var8) 0 == if{ (P:Absolute time, seconds) 2 + (>G:Var9) 1 (>G:Var8) } (G:Var8) 1 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 2 (>G:Var8) } (G:Var8) 2 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 3 (>G:Var8) } (G:Var8) 3 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 4 (>G:Var8) } (G:Var8) 4 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 5 (>G:Var8) } (G:Var8) 5 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 6 (>G:Var8) } (G:Var8) 6 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 7 (>G:Var8) } (G:Var8) 7 == (P:Absolute time, seconds) (G:Var9) > && if{ (P:Absolute time, seconds) 2 + (>G:Var9) 0 (>G:Var8) 0 (>L:Lbit_MFD, bool) } (G:Var8)and so on up to Case Value = 7..Any thoughts?

Share this post


Link to post
Share on other sites

Hi,Put the update section at the top of the gauge, not in an element.(Didn't check the code)So:(G:Var8) 0 == if{ (P:Absolute time, seconds) 2 + (>G:Var9) 1 (>G:Var8) } (G:Var8) 1 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 2 (>G:Var8) } (G:Var8) 2 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 3 (>G:Var8) } (G:Var8) 3 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 4 (>G:Var8) } (G:Var8) 4 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 5 (>G:Var8) } (G:Var8) 5 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 6 (>G:Var8) } (G:Var8) 6 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 7 (>G:Var8) } (G:Var8) 7 == (P:Absolute time, seconds) (G:Var9) >&& if{ (P:Absolute time, seconds) 2 + (>G:Var9) 0 (>G:Var8) 0(>L:Lbit_MFD, bool) } Codeetc.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest taipan_daz

Hey Jan, it worked!Sorry, I should have told you the layout before hand. I probably also could have solved that myself looking at the DTD couldn't I.Thanks again mate, I am really indebted to you.taipan_daz.

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...