Jump to content
Sign in to follow this  
phjvh

Three-way XML starter switch

Recommended Posts

Guest mtom

Hi all.I was hoping someone might be able to show me what code is needed to complete a three-way switch I'm working on (see XML code below). It's a starter switch for the two engine aircraft. I've got so far as to get it to trigger the events correctly, but it won't yet trigger the gauge animation. It seems to me that the click-event line of code needs sytax which links it with the bitmaps, but my experiments have come to nothing. In fact, they often render the switch inoperative.All thoughts welcome.Cheers,Matthew.(G:Var1)Starter Switch(G:Var1) (>K:TOGGLE_STARTER1)(G:Var1) (>K:TOGGLE_STARTER2)

Share this post


Link to post
Share on other sites

Hi, You need to give the (G:Var) a value in the click event.So for left: 1 (>G:Var1) and right 2 (>G:Var1)Then you must add something to get the switch back in the middle:(G:Var1) 0 ==Try something as: ("Left engine running") if{ 0 (>G:Var1) } etc.Hope it helps,Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest mtom

Hi Jan.Thanks for the help. I'm not sure I understand your suggestion, though. The click event syntax works okay, but I don't quite understand that for the 'value' code and I don't think I'm applying it correctly. I've included my interpretation below, which, by the way, doesn't work :-)Cheers,Matthew.("Left engine running") if { 0 (>G:Var1) } ("Right engine running") if { 0 (>G:Var1) }Starter Switch1 (>G:Var1) (G:Var1) 0 == (>K:TOGGLE_STARTER1)2 (>G:Var1) (G:Var1) 0 == (>K:TOGGLE_STARTER2)

Share this post


Link to post
Share on other sites

Matthew,Of course it won't work cause the example i gave contains a non existing value:("Left engine running") if {0 (>G:Var1) } ("Right engine running") if { 0(>G:Var1) }I didn't test it, but this one should work:(G:Var1)(P:Absolute Time,seconds) (G:Var2) > if{ 0 (>G:Var1) }>/Value>Left Starter Switch(G:Var1) 0 == if{ (P:Absolute Time,seconds) 2 + (>G:Var2) 1 (>G:Var1) (>K:TOGGLE_STARTER1) }Right Starter Switch(G:Var1) 0 == if{ (P:Absolute Time,seconds) 2 + (>G:Var2) 2 (>G:Var1) (>K:TOGGLE_STARTER2) }Now the starter bitmap will jump back from left or right to center after 2 seconds.Hope it helps,Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest mtom

Hi Jan.Thanks again for the code. Really appreciate it. I wasn't aware that the gauge need a second Var to instigate the switch's return to the centre position. One last thing. Is it possible to get the switch to execute the event for a little longer? I can see how you can get the gauge to execute the animiation for longer, but not the actual event. The reason I ask is that you need to hold the switch down with the mouse pointer for a second or two longer so as to get the engine to start. As it stands, you can currently hear the starter working, but it does not continue long enough for the engine going. Changing the animation time does not influence this.Once again, many thanks for the help so far.Cheers,Matthew.

Share this post


Link to post
Share on other sites
Guest Schulli

i used this code for a combined START/GEN-Switch. the switch is in the middle (OFF) position at startup with gen off. for engine start i have to hold the switch down until engine has started. if i release the switch it goes back to middle pos. to switch on gen i have to put the switch in the up pos. it works fine. (G:Var1) (A:General eng1 starter, bool) ! sp6 (A:General eng1 generator switch,bool) ! sp7 l6 l7 && if{ 0 (>G:Var1) } L Start Switch1 (>G:Var1) (>K:TOGGLE_STARTER1)L Gen Switch2 (>G:Var1) (>K:TOGGLE_ALTERNATOR1)

Share this post


Link to post
Share on other sites

Matthew,again not tested, but you could try this in the click section:left starter(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>G:Var1) (>K:TOGGLE_STARTER1) } (M:Event) 'Leave' scmp 0 == if{ 0 (>G:Var1) }Right one(M:Event) 'LeftSingle' scmp 0 == if{ 2 (>G:Var1) (>K:TOGGLE_STARTER2) } (M:Event) 'Leave' scmp 0 == if{ 0 (>G:Var1) }Hope it gives the desired result,Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest mtom

Hi Jan.Still no luck I'm afraid.Thanks for all the help anyway.Cheers,Matthew.

Share this post


Link to post
Share on other sites
Guest mtom

Hi there.Thanks for the code. Unfortunatley, I'm not getting any results, but I appreciate the suggestion.Cheers,Matthew.

Share this post


Link to post
Share on other sites
Guest knivpekka

Hi Matt,Did you replace all the ">" with ampersand-amp-semicolon etc.? Stupid question maybe. But I frequently forget this when I copy code from the forum posts.

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