Jump to content
Sign in to follow this  
phjvh

Time delay procedures in XML gauges...

Recommended Posts

Sorry, total newbie at gaugemaking here :(I'm making a custom (fantasy) panel for an aircraft, and would like the annunciator lights to all come on for X seconds when the master battery is turned on, turn off for X seconds, turn back on for X more seconds and finally go into their normal functionality, as a simulated startup self-test thingy....Problem is, I have absolutely no idea how to accomplish this, and the sdk isn't helping.. Could someone please help solve this?


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

Share this post


Link to post
Share on other sites

Thanks, I'll take a look when I get some time to work on it..... :)(Late reply, was out of town for a few days.....)


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

Share this post


Link to post
Share on other sites

Ok, I used the last gauge in the post mentioned earlier as a jumping-off point for my master battery switch, which should control the self-test display on the annunciator lights.It uses 2 L: variables to control the lights, which will be setup in a checkerboard fashion when one is 1 and one is 0. (Assuming that L: variables are shared between gauges, can't find any mention in the SDK on this.. Otherwise, how can I share variables between gauges?)The gauge uses the on/off bitmaps froom the cpt red rocker switch for the visual.My problem is that it does not show up in FS2002. No errors, no nothing. It's nothing in the panel.cfg, because switching the .xml with the battery.xml switch from the cpt.toggles.rocker.r package works.I may shorten the self-test display, as this might be a little much, but here's my code as it stands right now..... Can anyone find the problem? I'm stuck....------(G:Var1) 9 < if{ (A:Electrical master battery,bool) 1 == if{ (>K:TOGGLE_MASTER_BATTERY) } } els{ (A:Electrical master battery,bool) 0 == if{ (>K:TOGGLE_MASTER_BATTERY) } }(G:Var1) == 1 if{ (P:local time, seconds) (G:Var2) > if{ 2(>G:Var1) + (P:local time, seconds) 10 + (>G:Var2) } }(G:Var1) == 2 if{ (P:local time, seconds) (G:Var2) > if{ 3 (>G:Var1) + (P:local time, seconds) 10 + (>G:Var2) } }(G:Var1) == 3 if{ (P:local time, seconds) (G:Var2) > if{ 4 (>G:Var1) + (P:local time, seconds) 10 + (>G:Var2) } }(G:Var1) == 4 if{ (P:local time, seconds) (G:Var2) > if{ 5 (>G:Var1) + (P:local time, seconds) 5 + (>G:Var2) } }(G:Var1) == 5 if{ (P:local time, seconds) (G:Var2) > if{ 6 (>G:Var1) + (P:local time, seconds) 5 + (>G:Var2) } }(G:Var1) == 6 if{ (P:local time, seconds) (G:Var2) > if{ 7 (>G:Var1) + (P:local time, seconds) 10 + (>G:Var2) } }(G:Var1) == 7 if{ (P:local time, seconds) (G:Var2) > if{ 8 (>G:Var1) + (P:local time, seconds) 10 + (>G:Var2) } }(G:Var1) == 8 if{ (P:local time, seconds) (G:Var2) > if{ 9 (>G:Var1) } }(G:Var1) (A:Electrical master battery, bool) 1 == if{ (>K:TOGGLE_MASTER_BATTERY) } 0 (>L:dcSelfTestOne,enum) 0 (>L:dcSelfTestTwo,enum) 0 (>L:dcSelfTestOne,enum) 0 (>L:dcSelfTestTwo,enum) 1 (>L:dcSelfTestOne,enum) 1 (>L:dcSelfTestTwo,enum) 0 (>L:dcSelfTestOne,enum) 0 (>L:dcSelfTestTwo,enum) 1 (>L:dcSelfTestOne,enum) 1 (>L:dcSelfTestTwo,enum) 1 (>L:dcSelfTestOne,enum) 0 (>L:dcSelfTestTwo,enum) 0 (>L:dcSelfTestOne,enum) 1 (>L:dcSelfTestTwo,enum) 0 (>L:dcSelfTestOne,enum) 0 (>L:dcSelfTestTwo,enum) 1 (>L:dcSelfTestOne,enum) 1 (>L:dcSelfTestTwo,enum) 0 (>L:dcSelfTestOne,enum) 0 (>L:dcSelfTestTwo,enum) (A:Electrical master battery, bool) 0 == if { (>K:TOGGLE_MASTER_BATTERY) } Master Battery Switch(G:Var1) 0 == if{ 1 (>G:Var1) + (P:local time, seconds) 5 + (>G:Var2) } els{ 0 (>G:Var1) }-----Edit: Ok, that'll learn me to post before looking for faq's..... using IE, found the errors in the comments, 'case value"0"', and non-matching tags..... Now to get the rest of the bugs solved.... :D More specifically..... IE shows no errors, but it still does not show up on the panel, although it apparently loads and is active.....


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

Share this post


Link to post
Share on other sites

Hi, I had a look at your code and did some editing, this one works.(I tested only the Afterburner K-event)"Dummy" is a transparant background, "w,nw,n,ne,e,se,s,sw" are testbitmaps. (The K-event will make you deaf from toggling)You can do anything with it, changing the amount of seconds and K-event. (G:Var1) 1 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 2 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 2 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 3 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 3 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 4 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 4 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 5 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 5 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 6 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 6 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 7 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 7 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 8 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 8 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 9 (>G:Var1) } } (G:Var1) 9 == if{ (>K:TOGGLE_AFTERBURNER1) } (G:Var1)Test (P:Absolute time, seconds) 3 + (>G:Var2) 1 (>G:Var1) (>K:TOGGLE_AFTERBURNER1)Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Tried it....After making the modifications to suit my needs again, I now have a bloated plain vanilla switch that turns the master battery on and off without the switch visibly moving, staying off even if the battery is on. Which is wrong, because the battery should only turn itself on after the self-test is complete.Where dummy.bmp is a 46x72 plain black image for a dummy background.. Here's what I got now..... (G:Var1) 1 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 2 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 2 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 3 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 3 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 4 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 4 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 5 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 5 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 6 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 6 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 7 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 7 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 8 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 8 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 9 (>G:Var1) } } (G:Var1) 9 == if{ (>K:TOGGLE_AFTERBURNER1) } (G:Var1)0 (>L:dcSelfTestOne,number)0 (>L:dcSelfTestTwo,number)0 (>L:dcSelfTestOne,number)0 (>L:dcSelfTestTwo,number)1 (>L:dcSelfTestOne,number)1 (>L:dcSelfTestTwo,number)0 (>L:dcSelfTestOne,number)0 (>L:dcSelfTestTwo,number)1 (>L:dcSelfTestOne,number)1 (>L:dcSelfTestTwo,number)0 (>L:dcSelfTestOne,number)1 (>L:dcSelfTestTwo,number)1 (>L:dcSelfTestOne,number)0 (>L:dcSelfTestTwo,number)0 (>L:dcSelfTestOne,number)0 (>L:dcSelfTestTwo,number)1 (>L:dcSelfTestOne,number)1 (>L:dcSelfTestTwo,number)0 (>L:dcSelfTestOne,number)0 (>L:dcSelfTestTwo,number)Test (G:Var1) 0 == if{ (P:Absolute time, seconds) 3 + (>G:Var2) 1 (>G:Var1) (>K:TOGGLE_AFTERBURNER1)} els{ 0 (>G:Var1) (>K:TOGGLE_MASTER_BATTERY)


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

Share this post


Link to post
Share on other sites

Hi, Forget the Afterburner!!, it was just een example.Try:...... (G:Var1) 2 == if{ 1 (>L:dcSelfTestOne,enum)0 (>L:dcSelfTestTwo,enum) }......etc. (G:Var1) 9 == (A:CIRCUIT GENERAL PANEL ON, bool) 0 == && if{ (>K:TOGGLE_MASTER_BATTERY) els{ (0) }Try for the Click-event:Test (P:Absolute time, seconds) 3 + (>G:Var2) 1 (>G:Var1)Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Erm... I meant to TOGGLE_MASTER_BATTERY.... guess your example put afterburner in my mind.... :(Getting a bit closer......Tried the latest suggestion. When clicking the switch to turn the battery on, everything stayed dark for a number of seconds, then it started an endless loop flashing the master battery on and off.So, I moved the master battery toggle into the if{ section where it actually assigns the 9 to Var1, and that fixes that problem.However, the 2 L: variables apparently still do not get updated, as the annunciator lights remain off the whole time.Also can't use the switch to turn the battery back off, but if I put the more complicated click event back, I believe I can solve that....I'm getting the feeling that the Select/case section isn't working, as I added a couple lights bound *directly* to the 2 L: selftest variables, and they never light. Is there anything wrong with my select/case section? (G:Var1) 1 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 2 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 2 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 3 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 3 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 4 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 4 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 5 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 5 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 6 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 6 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 7 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 7 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 8 (>G:Var1) + (P:Absolute time, seconds) 2 + (>G:Var2) } } (G:Var1) 8 == if{ (P:Absolute time, seconds) (G:Var2) > if{ 9 (>G:Var1) (A:Circuit general panel,bool) 0 == if{ (>K:TOGGLE_MASTER_BATTERY) } } } (G:Var1) 0 (>L:dcSelfTestOne, bool)0 (>L:dcSelfTestTwo, bool)0 (>L:dcSelfTestOne, bool)0 (>L:dcSelfTestTwo, bool)1 (>L:dcSelfTestOne, bool)1 (>L:dcSelfTestTwo, bool)0 (>L:dcSelfTestOne, bool)0 (>L:dcSelfTestTwo, bool)1 (>L:dcSelfTestOne, bool)1 (>L:dcSelfTestTwo, bool)0 (>L:dcSelfTestOne, bool)1 (>L:dcSelfTestTwo, bool)1 (>L:dcSelfTestOne, bool)0 (>L:dcSelfTestTwo, bool)0 (>L:dcSelfTestOne, bool)0 (>L:dcSelfTestTwo, bool)1 (>L:dcSelfTestOne, bool)1 (>L:dcSelfTestTwo, bool)0 (>L:dcSelfTestOne, bool)0 (>L:dcSelfTestTwo, bool)Test(P:Absolute Time, seconds) 3 + (>G:Var2) 1 (>G:Var1)


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

Share this post


Link to post
Share on other sites

Hi,If you use: (G:Var1)you wil see a Knob rotating from "w", clockwise, via "e" to "nw".That is what happens with (G:Var1) 0-9.When for example you have (G:Var1) 0 == and you click, then you 'll see for a 3 seconds (G:Var1) 1 == , caused by the command 1 (>G:Var1), which means that the switch is in position "nw" etc.If you want more seconds, change ( P:Absolute Time, seconds) 3 + in for example ( P:Absolute Time, seconds) 10 + (10 seconds etc.)During the time (G:Var1) 1 == is active (3-10 seconds), you can let the situation perform an action as: (G:Var1) 1 == if{ 0 (>L:dcSelfTestOne, enum)1 (>L:dcSelfTestTwo, enum) } els { (0) } (G:Var1) 2 == if{ 1 (>L:dcSelfTestOne, enum)0(>L:dcSelfTestTwo, enum) } els { (0) }(G:Var1) 3 == if{ 1 (>L:dcSelfTestOne, enum)1 (>L:dcSelfTestTwo, enum) } els { (0) }(G:Var1) 4 == if{ 0 (>L:dcSelfTestOne, enum)0 (>L:dcSelfTestTwo, enum) } els { (0) }etc.... etc. etc.I think in this case enum works better than bool.I don't think your formula of the "actions" will work, so you have to try it as above.I will test the Master Battery Switch tonight, if i have some time.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Hi,I hope this will work:.................etc.................. (G:Var1) 9 == if{ (A:Electrical master battery,bool) 0 == if{ (>K:TOGGLE_MASTER_BATTERY) } } els{ (A:Electrical master battery,bool) 1 == if{ (>K:TOGGLE_MASTER_BATTERY) } }..............etc. (G:Var1) 0 == if{ 1 (>G:Var1) + (P:Local Time, seconds) 5 + (>G:Var2) } els{ 0 (>G:Var1) }Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Ok, I decided I'd better move this code into a seperate gauge and use a normal master battery switch, and bind the self-test procedure to the battery circuit toggling, instead of binding directly to the switch. This should allow the self-test to run, even if I use the keyboard shortcut to turn on the master battery. :) Downside is that the master battery will have to be on during the self-test, but that's no big deal.Long story short, after the above changes and some rearranging, it now works exactly as it is supposed to. :D :D :D :D (Thanks to 3 debug indicator lights and your idea of a spinning knob (in my case a simple arrow). :)Now, I have a new problem. I need the self-test to completely override all the annunciator lights. I added a new L: variable which is set to 1 when the battery is turned on, and set back to 0 when the self-test is complete, which should serve as the "self-test override" variable.So, I figured.... if override=1 then if selftestone=1 then show light on else show light off end ifelse if realcondition=1 then show light on else show light off end ifend ifTo the best of my knowledge, that's exactly what I have in XML, but it doesn't work at all, either during the self-test or when the actual condition is met. (For example, if the parking brake is set.)Is there anything wrong with this? (A:Circuit general panel on, bool) (L:dcSelfTestRunning, enum) 1 == if{ (L:dcSelfTestOne, enum) 1 == if{ } els{ } } els{ (A:Brake Parking Indicator, bool) 1 == if{ } els{ } }


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

Share this post


Link to post
Share on other sites

Hi,Try something like this and see what happens, you can use it in any gauge anywhere on the panels:............ (A:Brake parking position, percent) 50 > (L:testswitch, bool) ||BREAK........... (P:Absolute time, seconds) (L:Testtimer,seconds) > if{ 0 (>L:testswitch, bool) }........... (P:Absolute time, seconds) 7 + (>L:Testtimer,seconds) 1 (>L:testswitch, bool)Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Hi,Tested this for the master battery.In combination with the foregoing post you can achieve the "Test" thing with:" (L:testswitch, bool) || " anywhere in the panel,...............(G:Var1) 1 == if{ (L:testswitch, bool) 0 == if{ (L:testswitch, bool) ! (>L:testswitch, bool) } (>K: PANEL_LIGHTS_ON) (P:Absolute time, seconds) (G:Var2) > if{ 2 (>G:Var1) + (P:Absolute time, seconds) 3 + (>G:Var2) } } (G:Var1) 2 == if{ (L:testswitch, bool) 1 == if{ (L:testswitch, bool) ! (>L:testswitch, bool) } (>K: PANEL_LIGHTS_OFF) (P:Absolute time, seconds) (G:Var2) > if{ 0 (>G:Var1) + (P:Absolute time, seconds) 3 + (>G:Var2) } }............... (P:Absolute time, seconds) 3 + (>G:Var2) 1 (>G:Var1) (>K:TOGGLE_MASTER_BATTERY)I used the Panel lights event only for test.When you press the switch the Battery is on and the test is in progress during a few seconds and stops then.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

I appreciate the help immensely. I'd have given up long ago without it..... :)But, to make this concept work as intended, I really just need a gauge template for each annunciator light that basically follows the following pseudocode:if (L:dcSelfTestRunning, enum) == 1 then if (L:dcSelfTestOne, enum) == 1 then show "Parking brake light on.bmp" else show "generic light off.bmp" end ifelse if (A:Brake Park position, percent) > 50% then show "Parking brake light on.bmp" else show "generic light off.bmp" end ifend ifVisible only if the master battery circuit is on, of course.The annunciator light code I posted *should* do exactly that, from my understanding, but it doesn't even load in FS, but IE shows no errors.The (invisible?) selftest.xml gauge already works to perfection now, and it controls the variables that will trigger the self-test override.


StoneC0ld_zps439869f4.png

Declared weather:  FSX: ASN / FS9: ASE

 

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