Sign in to follow this  
Alba

First XMl gauge probs

Recommended Posts

Hi Folks. As a complete beginner to XML I have been using the tutorials mentioned by Bill in another post. After a few attempts I now have the gauge positioned on my panel within Panel Studio.However, the gauge does not show in the Sim. This has got me stumped. I can only assume the sim does not like the gauge and it's XMl.I have most probably coded the gauge either incorrectly and or clumsily. It is a switchable gauge with a choice of 3 bmp's. Off, Red light on, green light on. Dependant on mouse clicks. It is, I assume very simple to code but I have gone wrong somewhere. I am not sure of the G Var and it's relationship to mouse clicks.I would greatly appreciate an offer from someone to check the code and advise me of my errors. I would post the code here for checking.Regards...Ken

Share this post


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

Hi Ken,Just show the code.This is an example of a 3 way switch:(don't use G:Var's, but L:Var's!)(L:YOUR VAR,enum)"Click"What you need, green to off(L:YOUR VAR,enum) 1 - 0 max (>L:YOUR VAR,enum) What you need, off to green(L:YOUR VAR,enum) 1 + 2 min (>L:YOUR VAR,enum) Or you can do it in one clickspot with right and left click of the mouse:What you need(M:Event) 'LeftSingle' scmp 0 == if{ (L:YOUR VAR,enum) 1 - 0 max (>L:YOUR VAR,enum) } (M:Event) 'RightSingle' scmp 0 == if{ (L:YOUR VAR,enum) 1 + 2 min (>L:YOUR VAR,enum) } Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi KenNot sure if this would help, but this is a three click Switch I use to select which hydraulic pump I want to use.(L:Hydraulic Switch Startup,enum) 0 == if{ 1 (>L:Hydraulic Select,enum) 1 (>L:Hydraulic Switch Startup,enum) } (L:Hydraulic Select,enum) Hydraulic Select Switch(L:Hydraulic Select,enum) 0 > if{ (L:Hydraulic Select,enum) 1 - (>L:Hydraulic Select,enum) } Hydraulic Select Switch(L:Hydraulic Select,enum) 2 < if{ (L:Hydraulic Select,enum) 1 + (>L:Hydraulic Select,enum) } If you post the code you have tried, then we could help a little more.

Share this post


Link to post
Share on other sites

Hi Folks, thanks for the help and time you've taken. Boy, I feel slightly embarrased when I look at your code. It seems much more complex than mine. Still, I am just learning and your code helps my understanding.I have three bmp's as I said. Oh, I also made the 'off' bmp as a background image. I got the impression that gauges should use a background. I made the switch off position in the middle with the red light to the left and the green light to the right. My intention is obviously to start in the middle (off) then click, red light bmp displays with switch to the left. Click again and green light bmp displays with switch to the right. Click again and off bmp shows with switch in the middle. This is for a cargo drop light for a Herc. I printed off the XML for the Baron Flap switch and I see that it uses one background and superimposes the lights as required. So I understand that there are differing ways to achieve an effect.Anyway, here's my code as per what I picked up from the tutorials. Please comment as you see fit!! (G:Var1)Cargo_Drop_Lights1(>G:Var1)REgards...Ken

Share this post


Link to post
Share on other sites

Sorry about the Smiley.I've just noticed that the option for them is on. OOPS.Ken

Share this post


Link to post
Share on other sites

Hi Ken Not tested but should work. (L:Cargo Drop Switch Startup,enum) 0 == if{ 1 (>L:Cargo Drop Lights,enum) 1 (>L:Cargo Drop Switch Startup,enum) } (L:Cargo Drop Lights,enum) Hydraulic Select Switch(L:Cargo Drop Lights,enum) 0 > if{ (L:Cargo Drop Lights,enum) 1 - (>L:Cargo Drop Lights,enum) } Hydraulic Select Switch(L:Cargo Drop Lights,enum) 2 < if{ (L:Cargo Drop Lights,enum) 1 + (>L:Cargo Drop Lights,enum) } It will start up in position one when the aircraft is first loaded (Off), and then by clicking up or down you select the other positions, as your bitmaps are different you will need to alter the Area positions to suit your needs.Hope this helps

Share this post


Link to post
Share on other sites

Hi Co-Pilot. Thanks for the code. It is a lot more involved than what I took out of the tutorial. I will print it off and follow it through alongside the tut.I will post back and let you know what happens, although I am sure it will work ok. It seems complex as a beginner but I suppose the gauge is quite straightforward.Regards...Ken

Share this post


Link to post
Share on other sites

Hello again guys. I have read through your code and realised that I have inadvertantly misled you.I have used the default Aileron Trim bmp's to define the switch. This is a rotary type switch. I have used Trim_0, Trim_Minus_3 and Trim_Plus_3 for the three bmp's. The red and green lights are at the 10 and 2 positions respectively. The bmp's all have the red and green lights in different states of illumination to suit the switch position.This of course means that the switch will be activated by a click spot within the switch body. The Area locations in my code define that spot. The startup bmp will be the Trim_0 (Middle)(OFF) and then I would select the Red_ON (Minus_3)and then Green_ON (Plus_3)and then back to OFF.Will that fact alter the code in the (L: line and also in the (L: line ?Please excuse this oversight and would you mind redoing the code for me as neccessary? I am still needing pointed in the right direction,, Sorry!!Regards...Ken

Share this post


Link to post
Share on other sites

Hi,Here, try your gauge, tested and working:(G:Var1)Cargo_Drop_Lights(G:Var1) 0 == if{ 1 (>G:Var1) } els{ (G:Var1) 1 == if{ 2 (>G:Var1) } els{ (G:Var1) 2 == if{ 0 (>G:Var1) } } } NB. Your click command was wrong, you only get (G:Var1) = 1Now you get them all, 0-->1-->2.May be you don't need the background image and update section?Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hello again Jan. Thanks for re-doing the code. I will make the gauge and follow through the code. As with all things, once understanding comes then things become easier. I need to learn the syntax for the XML and be able to think it through.Regards...Ken

Share this post


Link to post
Share on other sites

YES, it works, but you said that of course. Great, thanks to all!! Now, I need to understand the Click part. The == and the IF part. I can see the 'why' just not the 'how' as yet. I'll go read the Tutorial again!!Regards...Ken

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