July 27, 200916 yr HiI'm really finding it hard to get to grips with XML gauge programming, I'm trying to make a standby attitude gauge for a 737NG panel but I have great difficulty in doing so, can someone guide me through how to make one? I've made the graphics already I just need to learn how to code it!Thanks
July 27, 200916 yr Commercial Member <Gauge Name="Attitude-Indicator" Author="Engjell Berisha"><Image Name="Attitude-Indicator.bmp"/> <Element> <Position X="0" Y="0"/> <MaskImage Name="Attitude-Indicator-Mask.bmp"> <Axis X="153" Y="153"/> </MaskImage> <Image Name="Attitude-Indicator-Card.bmp" Bright="Yes"> <Axis X="103" Y="351"/> </Image> <Shift> <Value Minimum="-90" Maximum="90">(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator pitch degrees:1, degrees) /-/ }</Value> <Scale Y="1.6"/> </Shift> <Rotate> <Value>(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> </Rotate> </Element> <Element> <Image Name="Attitude-Indicator-Shadow.bmp" Alpha="Yes"/> </Element> <Element> <Position X="0" Y="0"/> <MaskImage Name="Attitude-Indicator-Mask.bmp"> <Axis X="153" Y="153"/> </MaskImage> <Image Name="Attitude-Indicator-Arrows.bmp" Bright="Yes"> <Axis X="153" Y="153"/> </Image> <Rotate> <Value>(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> </Rotate> </Element> <Element> <Image Name="Attitude-Indicator-Plane.bmp"/> </Element> <copyright>(c)2009 Engjell Berisha</copyright></Gauge> Above is all the code I use to drive my back-up attitude Indicator. If you need the images to help you understand I can show you those too although there's only two.Also you need to understand that my back-up attitude indicator is governed by the Lvar BAT-PWR,bool which is a fairly complex Lvar defining electrical system integrity. If you plan on using it without governing it to my Lvar - which will not work on your panel - you need to get ride of all the (L:BAT-PWR,bool) 1 == for example: <Value>(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> should be <Value>(A:Attitude indicator bank degrees:1, radians)</Value> The thing is this will work even when your battery is out, if you want it to work with the battery on only then you make it like so: <Value>(A:ELECTRICAL MASTER BATTERY,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> Hope that helps, wish you the best of luck. Good Day, Engjell Berisha
July 27, 200916 yr <Gauge Name="Attitude-Indicator" Author="Engjell Berisha"><Image Name="Attitude-Indicator.bmp"/> <Element> <Position X="0" Y="0"/> <MaskImage Name="Attitude-Indicator-Mask.bmp"> <Axis X="153" Y="153"/> </MaskImage> <Image Name="Attitude-Indicator-Card.bmp" Bright="Yes"> <Axis X="103" Y="351"/> </Image> <Shift> <Value Minimum="-90" Maximum="90">(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator pitch degrees:1, degrees) /-/ }</Value> <Scale Y="1.6"/> </Shift> <Rotate> <Value>(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> </Rotate> </Element> <Element> <Image Name="Attitude-Indicator-Shadow.bmp" Alpha="Yes"/> </Element> <Element> <Position X="0" Y="0"/> <MaskImage Name="Attitude-Indicator-Mask.bmp"> <Axis X="153" Y="153"/> </MaskImage> <Image Name="Attitude-Indicator-Arrows.bmp" Bright="Yes"> <Axis X="153" Y="153"/> </Image> <Rotate> <Value>(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> </Rotate> </Element> <Element> <Image Name="Attitude-Indicator-Plane.bmp"/> </Element> <copyright>(c)2009 Engjell Berisha</copyright></Gauge> Above is all the code I use to drive my back-up attitude Indicator. If you need the images to help you understand I can show you those too although there's only two.Also you need to understand that my back-up attitude indicator is governed by the Lvar BAT-PWR,bool which is a fairly complex Lvar defining electrical system integrity. If you plan on using it without governing it to my Lvar - which will not work on your panel - you need to get ride of all the (L:BAT-PWR,bool) 1 == for example: <Value>(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> should be <Value>(A:Attitude indicator bank degrees:1, radians)</Value> The thing is this will work even when your battery is out, if you want it to work with the battery on only then you make it like so: <Value>(A:ELECTRICAL MASTER BATTERY,bool) 1 == if{ (A:Attitude indicator bank degrees:1, radians) }</Value> Hope that helps, wish you the best of luck. HiThank you very much for your reply. My attitude gauge is basic, it is just the attitude 'card' and the pointer that indicates the plane and the mask. Would I just need to take out all the bits in your code that don't apply to me? So the code becomes:<Gauge Name="Attitude-Indicator" Author="Engjell Berisha"><Image Name="Attitude-Indicator.bmp"/> <Element> <Position X="0" Y="0"/> <MaskImage Name="Attitude-Indicator-Mask.bmp"> <Axis X="153" Y="153"/> </MaskImage> <Image Name="Attitude-Indicator-Card.bmp" Bright="Yes"> <Axis X="103" Y="351"/> </Image> <Shift> <Value Minimum="-90" Maximum="90">(A:Attitude indicator pitch degrees:1, degrees) /-/ }</Value> <Scale Y="1.6"/> </Shift> <Rotate> <Value>(A:Attitude indicator bank degrees:1, radians) }</Value> </Rotate> </Element> <Element> <Position X="0" Y="0"/> <Rotate> <Value>(A:Attitude indicator bank degrees:1, radians) }</Value> </Rotate> </Element> <Element> <Image Name="Attitude-Indicator-Plane.bmp"/> </Element> <copyright>(c)2009 Engjell Berisha</copyright></Gauge> Would you mind showing me your bitmaps aswell just so I can see what's going on?Thanks!
July 27, 200916 yr Commercial Member You're on the right track, but you missed a small thing that's fairly important. When you removed the bit of code that pertained to my particular panels you didn't remove it properly, below is the code with the bit you forgot to remove in red:<Value Minimum="-90" Maximum="90">(A:Attitude indicator pitch degrees:1, degrees) /-/ }</ValueYou did that with all of them, just remeber to remove the "}" that closes the "IF" statement as to write an if statement you need to wrap the code to be affected in "if{ CODE HERE }" you only removed the "if{" and forgot the end of it "}"The only reason I had my code wrapped in that text is to say if the aircraft is properly configured then the code works, having removed it now the gauge will always work, even if all the electrical power on the plane is down including stby and bat.Here's my gauge bitmaps all named as they are in the coding:http://i18.photobucket.com/albums/b111/EV0...ator-Arrows.jpghttp://i18.photobucket.com/albums/b111/EV0...icator-Card.jpghttp://i18.photobucket.com/albums/b111/EV0...icator-Mask.jpghttp://i18.photobucket.com/albums/b111/EV0...cator-Plane.jpghttp://i18.photobucket.com/albums/b111/EV0...ator-Shadow.jpghttp://i18.photobucket.com/albums/b111/EV0...e-Indicator.jpgI can't post the actual pictures as they're bigger than the allowed size.BTW, here's a helpful tip in the code below: <Shift> <Value Minimum="-90" Maximum="90">(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator pitch degrees:1, degrees) /-/ }</Value> <Scale Y="1.6"/> </Shift>The way I derived that scale is I went from the 0 line on my bitmap to the first hash mark on it which is thirty than I took the Y pixels and divided by 30 and I get that the Y scale is 1.6 Good Day, Engjell Berisha
July 27, 200916 yr You're on the right track, but you missed a small thing that's fairly important. When you removed the bit of code that pertained to my particular panels you didn't remove it properly, below is the code with the bit you forgot to remove in red:<Value Minimum="-90" Maximum="90">(A:Attitude indicator pitch degrees:1, degrees) /-/ }</ValueYou did that with all of them, just remeber to remove the "}" that closes the "IF" statement as to write an if statement you need to wrap the code to be affected in "if{ CODE HERE }" you only removed the "if{" and forgot the end of it "}"The only reason I had my code wrapped in that text is to say if the aircraft is properly configured then the code works, having removed it now the gauge will always work, even if all the electrical power on the plane is down including stby and bat.Here's my gauge bitmaps all named as they are in the coding:http://i18.photobucket.com/albums/b111/EV0...ator-Arrows.jpghttp://i18.photobucket.com/albums/b111/EV0...icator-Card.jpghttp://i18.photobucket.com/albums/b111/EV0...icator-Mask.jpghttp://i18.photobucket.com/albums/b111/EV0...cator-Plane.jpghttp://i18.photobucket.com/albums/b111/EV0...ator-Shadow.jpghttp://i18.photobucket.com/albums/b111/EV0...e-Indicator.jpgI can't post the actual pictures as they're bigger than the allowed size.BTW, here's a helpful tip in the code below: <Shift> <Value Minimum="-90" Maximum="90">(L:BAT-PWR,bool) 1 == if{ (A:Attitude indicator pitch degrees:1, degrees) /-/ }</Value> <Scale Y="1.6"/> </Shift>The way I derived that scale is I went from the 0 line on my bitmap to the first hash mark on it which is thirty than I took the Y pixels and divided by 30 and I get that the Y scale is 1.6
July 28, 200916 yr Moderator You do know that there are several hundred examples right on your computer. All you need to do is "unCAB" the .CAB files in the default aircraft's ..\panel folders.That's how most everyone learns...BTW, you can use the built-in 'unzip' utility of windows. Just be sure to unzip the .CAB file to a folder with the same name as the .CAB file to keep everything sorted properly... ;)If you haven't already, you should check out the tutorials at http://fs2x.com/Tutorials.htm Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
July 28, 200916 yr You do know that there are several hundred examples right on your computer. All you need to do is "unCAB" the .CAB files in the default aircraft's ..\panel folders.That's how most everyone learns...BTW, you can use the built-in 'unzip' utility of windows. Just be sure to unzip the .CAB file to a folder with the same name as the .CAB file to keep everything sorted properly... ;)If you haven't already, you should check out the tutorials at http://fs2x.com/Tutorials.htm OK thanks BillI'll definitely do that next time!
Create an account or sign in to comment