Sign in to follow this  
phjvh

Same gauge in the same window but independent working

Recommended Posts

hi,If four same switches are installed in the same window how it's possible to get their work independent?I renamed all in different way but the behaviour still the same. Now if I operate a switch all other together move in the same manner.Thanks G.Franco

Share this post


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

Hi,The LVar's must be different.So:Position 1...(L:switch 1,bool)...Position 2...(L:switch 2,bool)...etc.Area 1...(L:switch 1,bool) ! (>L:switch 1,bool)...Area 2...(L:switch 2,bool) ! (>L:switch 2,bool)...etc.If this is what you mean, i hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

- Size X="166" Y="45" - - (L:switch 1,bool) - - - - (L:switch 2,bool) - - - - (L:switch 3,bool) - - - - (L:switch 4,bool) - - - - - Failure switches Area left="5" Top="0" Width="5" Height="45"/> (L:switch 1,bool) ! (>L:switch 1,bool) ! (>L:switch 1,bool) ! (>L:switch 1,bool) Area left="5" Top="0" Width="5" Height="45"/> (L:switch 2,bool) ! (>L:switch 2,bool) ! (>L:switch 2,bool) ! (>L:switch 2,bool) Area left="5" Top="0" Width="5" Height="45"/> (L:switch 3,bool) ! (>L:switch 3,bool) ! (>L:switch 3,bool) ! (>L:switch 3,bool) Area left="5" Top="0" Width="5" Height="45"/> (L:switch 4,bool) ! (>L:switch 4,bool) ! (>L:switch 4,bool) ! (>L:switch 4,bool)the difference is that for all the intended switches 4.bmps are neededand at each click all those event will be carried out:1)the switch appear guarded2)the switch guard will be opened and the switch is centered3)the switch will be operated up4)the switch will be operated to center 5)the switch will be operated down6)the switch will be operated to center7)the guard will be closedI choise always gauges without any tutorial.Cheers Gianfranco

Share this post


Link to post
Share on other sites

Hi,That code will not work.Do you want to have the guarded switch in one clickspot with your sequence of events?Then try something like (first switch):(L:switch 1,enum)Failure switches(L:switch 1,enum) 1 + (>L:switch 1,enum) (L:switch 1,enum) 6 == if{ 0 (>L:switch 1,enum) } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Btw.I do it this way:(L:switch,enum)(L:guard,bool)(M:Event) 'LeftSingle' scmp 0 == if{ (L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 == if{ 0 (>L:switch,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool) } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

(L:switch,enum)(L:guard,bool)(M:Event) 'LeftSingle'scmp 0 == if{ (L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 == if{ 0 (>L:switch,enum)}}} (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool)}the switch appears but doesn't move.I think because in your examplethe same .bmp has been called by two different names:first time :switch center.bmpsecond time:guard open.bmpanyway I called it by same name but the switch cannot be moved and the Click Hand doesn't even appear.Check the code I'm using please and if you find same error it will be very appreciated all your suggestions.cheers Gianfranco

Share this post


Link to post
Share on other sites

Hi,Is this the whole code of the gauge?Where are area and tooltip etc.?Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

- - - (L:switch,enum) - - - - - (L:guard,bool) - - - Failure switches(M:Event) 'LeftSingle'scmp 0 == if{ (L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 == if{ 0 (>L:switch,enum)}}} (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool)}(M:Event) 'LeftSingle'scmp 0 == if{ (L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 == if{ 0 (>L:switch,enum)}}} (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool)}here the complete code but still not working.I think I made a little confusion with "LeftSingle + RightSingle"Cheers Gianfranco

Share this post


Link to post
Share on other sites

Hi,Try:(L:switch,enum)(L:guard,bool)Failure switches(M:Event) 'LeftSingle' scmp 0 == if{ (L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 == if{ 0 (>L:switch,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool) } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

hi,the gauge still not working.I checked the code ,bmps,etc with no result.The gauge appears but not works.Gianfranco

Share this post


Link to post
Share on other sites

Well,That is strange, because it is working without any problems in my panel.Give the whole code again.NB. watch the spaces!Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Btw,Stupid question, do you use the right mouse button too?Open the guard with the right mouse-button and operate the switch with the left-mouse button.As another example here the code of one of my other switches:....(L:altn gear,bool) (L:capt instr bus AC volts,number) 100 > if{ (L:panellights, bool) } 2 * +(L:altn gear guard,bool) (L:capt instr bus AC volts,number) 100 > if{ (L:panellights, bool) } 2 * +....AltnGear(M:Event) 'LeftSingle' scmp 0 == if{ (L:altn gear guard,bool) if{ (L:altn gear,bool) ! (>L:altn gear,bool) (>K:GEAR_PUMP) 1 (>L:switch,number) } } (M:Event) 'RightSingle' scmp 0 == if{ (L:altn gear guard,bool) ! (>L:altn gear guard,bool) 1 (>L:guard,number) } Study and replace with your bmp's and L:Var'sHope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

- - - (L:switch,enum) - - - - - (L:guard,bool) - - - - Failure switches(M:Event) 'LeftSingle' scmp 0 == if{(L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 == if{ 0 (>L:switch,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool) }Now adjusting some spaces the rightSingle click is working and the guard opens and closes.The leftSingle click doesn't produce any event and the switch remains centered.Gianfranco

Share this post


Link to post
Share on other sites

Hi,I think this is the solution, I use L:init, which automatically sets the switch to 0 at startup of the sim.So try to use:Failure switches(M:Event) 'LeftSingle' scmp 0 == if{ (L:guard,bool) if{ (L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 > if{ 0 (>L:switch,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool) } or make an init, like:(L:init,enum) 0 ==if{ 0 (>L:switch,enum) 1 (>L:init,enum) } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

- - - (L:switch,enum) - - - - - (L:guard,bool) - - - - Failure switches(M:Event) 'LeftSingle' scmp 0 == if {(L:guard,bool) if {(L:switch,enum) 1 + (>L:switch,enum) (L:switch,enum) 2 > if { 0 (>L:switch,enum) }}} (M:Event) 'RightSingle' scmp 0 == if{ (L:guard,bool) ! (>L:guard,bool) }Tryied also with Init value but the LeftSingle click doesn't work.In the LeftSingle code you changed:(L:switch,enum) 2 ==to (L:switch,enum) 2 >but anyway it still not working in both cases.Probably the error resides there in the LeftSingle code.G.Franco

Share this post


Link to post
Share on other sites

>Probably the error resides there in the LeftSingle code.>G.FrancoYes, it is there. Replace "if {" with "if{" - No spaces allowed here.Tom

Share this post


Link to post
Share on other sites

Hi,I see some spaces error.(1. after if no spaces.2. between code and after { or } always a space)Try again:(M:Event) 'LeftSingle' scmp 0 ==space if{space (L:guard,bool)space if{space (L:switch,enum)space1space+space(>L:switch,enum)space (L:switch,enum)space2space>spaceif{space0space(>L:switch,enum)space}space space} space} (M:Event) 'RightSingle' scmp 0 ==spaceif{space(L:guard,bool)space!space(>L:guard,bool)space} Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

(L:switch1,enum)(L:guard1,bool)Failure switches (M:Event) 'LeftSingle' scmp 0 == if{ (L:guard1,bool) if{ (L:switch1,enum) 1 + (>L:switch1,enum) (L:switch1,enum) 2 > if{ 0 (>L:switch1,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard1,bool) ! (>L:guard1,bool) } this is the code after the last space check but the result still the same.LeftSingle click doesn't works.Gianfranco

Share this post


Link to post
Share on other sites

Hi Gianfranco,I just paid a little more attention to your code, and actually it is probably working ok; the problem is that you will never see the switch in the up or down position because you are stamping the "guarded/not guarder" bitmap over the "switch position" bitmap.As it is coded, the only possible bitmaps to see are "Cpt1FO2guard.bmp" and "Cpt1FO2notguard.bmp"; and it seems that this last one also includes the switch in the center position.A solution fo this would be to use a command in the second element, discarding the structure, like: (L:guard1,bool)And that's it.Tom

Share this post


Link to post
Share on other sites

Hi,I tested the whole gauge except with my own bitmaps and everthing is working perfect.So there must be something wrong with your bitmaps, transparancy, #000000 ??I use for the guard open and close the same size bitmaps, but when the guard is open you only see the flipped open part, the rest is transparant, so you will see the switch below.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

hi,thanks for your help.Now the bitmaps are visible but to switch up or down you have to pass always for "Cpt1FO2guard.bmp". This is my code now:(L:switch1,enum)(L:guard1,bool)Failure switch(M:Event) 'LeftSingle'scmp 0 == if{ (L:guard1,bool) if{ (L:switch1,enum) 1 + (>L:switch1,enum) (L:switch1,enum) 2 > if{ 0 (>L:switch1,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard1,bool) ! (>L:guard1,bool) }

Share this post


Link to post
Share on other sites

Hi,Can you show some pictures?Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

(L:switch1,enum)(L:guard1,bool)Failure switch(M:Event) 'LeftSingle'scmp 0 == if{ (L:guard1,bool) if{ (L:switch1,enum) 1 + (>L:switch1,enum) (L:switch1,enum) 2 > if{ 0 (>L:switch1,enum) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:guard1,bool) ! (>L:guard1,bool) }now by this code the bitmaps are visible but:1)the switch starts with guard open and cannot be closed2)the LeftSingle click as usual is under service.Only by rightSingle one you can move the switch but you cannot close the guard.I still considering that an error resides in the LeftSingle click.Gianfranco

Share this post


Link to post
Share on other sites

Well,I think you have to show your bitmaps and after that we can test them and the code again, because in my panel, with a lot of guarded switches, everything is working perfect.see example: guard with pushbutton below.Jan"Beatus ille qui procul negotiis..."http://forums.avsim.net/user_files/175901.jpg

Share this post


Link to post
Share on other sites

Gianfranco,I think you need to understand what the code it trying to accomplish. In fact it is a matter of pure logic; XML in gauges is 99.99 % a logical scripting system, so if you don't get the logic the road becomes steeper. Now let's see some reasoning:"1)the switch starts with guard open and cannot be closed"It means that "Cpt1FO2notguard.bmp" is not the starting bitmap, but "Cpt1FO2guard.bmp" (was the other name?) is, so make the proper replacement in the second element. "2)the LeftSingle click as usual is under service.Only by rightSingle one you can move the switch but you cannot close the guard.I still considering that an error resides in the LeftSingle click."Now, if you analize 'LeftSingle' code, forgetting about spaces, etc, and you see it meets the logic, THEN if it is not working, you go to the first element involved, and it also seems to be right, THEN you go back to the 'LeftSingle' part and watch for errors in spaces, etc.And precisely, this part 'LeftSingle'scmp 0 == lacks of a space between 'LeftSingle' and 'scmp'. This error wasn't present in the previous example, that's the reason it may be difficult to detect.My point here is, I am not giving you a working code, but trying to show you a way to figure out the wrong parts so that you could learn to fix them by yourself. I hope you'll understand :-)Tom

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