Sign in to follow this  
Guest mtom

Spring-loaded XML switch

Recommended Posts

Hi all.Does anyone know how I can make a spring-loaded switch in XML? I've developed a magnetos kill switch (see XML code below) for a two-engine aircraft ('pull-out' for off). The problem is that 'push in' also functions as off. However, if it was sringloaded (returning to its original 'in' position after a short delay), then the switch would only work on a 'pull-out' basis.I've seen sringloading work on a number of other XML switches, but it's not clear to me what part of the code is responsible.Any ideas?Cheers,Matthew.(G:Var1,bool)Magnetos Kill Switch(G:Var1) ! (>G:Var1) (G:Var1) if{ 0 (>K:MAGNETO1_BOTH) (>K:MAGNETO1_LEFT) (>K:MAGNETO1_RIGHT) (>K:MAGNETO2_BOTH) (>K:MAGNETO2_LEFT) (>K:MAGNETO2_RIGHT) } els{ 0 (>K:MAGNETO1_OFF) (>K:MAGNETO2_OFF) }

Share this post


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

Matthew,This is a spring loaded switch I use on my up and coming NG Panel. By holding the mouse on the lower part the switch stays down until you let go when it pops back up, same at the top.Hope it helps!(L:FUEL FLOW SWITCH POSITION, number)Fuel Flow/Used Switch - Reset(M:Event) 'LeftSingle' scmp 0 == if{ -1 (>L:FUEL FLOW SWITCH POSITION, number) (L:ENG1 FUEL USED, number) (>L:ENG1 FUEL RESET VALUE, number) (L:ENG2 FUEL USED, number) (>L:ENG2 FUEL RESET VALUE, number) } (M:Event) 'Leave' scmp 0 == if{ 0 (>L:FUEL FLOW SWITCH POSITION, number) }Fuel Flow/Used Switch - Used(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:FUEL FLOW SWITCH POSITION, number) } (M:Event) 'Leave' scmp 0 == if{ 0 (>L:FUEL FLOW SWITCH POSITION, number) }

Share this post


Link to post
Share on other sites

Hi Paul.Thanks for the code.Sorry I've not got back to earlier, but have been trying in the mean time to apply the code to my gauge problem. I'm afraid I've tried everything I can think of, but to no effect.Thanks for the thought anyway.Cheers,Matthew.

Share this post


Link to post
Share on other sites

Hi,Not tested, just an idea, play with something like:(G:Var1)(G:Var1) 1 == (P:Absolute Time,seconds) (G:Var2) > and if{ 2 (>G:Var1) }(G:Var1) 3 == (P:Absolute Time,seconds) (G:Var2) > and if{ 0 (>G:Var1)Magnetos Kill Switch(G:Var1) 0 == if{ 1 (>G:Var1) (P:Absolute Time,seconds) 0.5 + (>G:Var2) (>K:"ACTION MAGNETOS OFF") } (G:Var1) 2 == if{ 3 (>G:Var1) (P:Absolute Time,seconds) 0.5 + (>G:Var2) (>K:"ACTION MAGNETOS ON") }Hope it helps,Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Yee-haar! Many thanks for the code Jan. Got it going perfectly with little more experimention. Your version had the animation working right, but not the effect. Edited the K-event syntax and works like a beut! Much appreciated. For anyone else faced with the same issue, I've included the final code below.Cheers,Matthew.(G:Var1)(G:Var1) 1 == (P:Absolute Time,seconds) (G:Var2) > and if{ 2 (>G:Var1) }(G:Var1) 3 == (P:Absolute Time,seconds) (G:Var2) > and if{ 0 (>G:Var1)Magnetos Kill Switch(G:Var1) 0 == if{ 1 (>G:Var1) (P:Absolute Time,seconds) 0.5 + (>G:Var2) (>K:MAGNETO_OFF) } (G:Var1) 2 == if{ 3 (>G:Var1) (P:Absolute Time,seconds) 0.5 + (>G:Var2) (>K:MAGNETO_ON) }

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