January 15, 200521 yr 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)
January 15, 200521 yr Author 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" Jan "Beatus ille qui procul negotiis..."
January 16, 200521 yr 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)
January 16, 200521 yr Author 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" Jan "Beatus ille qui procul negotiis..."
January 21, 200521 yr 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.
January 21, 200521 yr 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)
January 21, 200521 yr Author 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" Jan "Beatus ille qui procul negotiis..."
January 29, 200521 yr Hi there.Thanks for the code. Unfortunatley, I'm not getting any results, but I appreciate the suggestion.Cheers,Matthew.
February 2, 200521 yr 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.
Create an account or sign in to comment