Results 1 to 9 of 9

Thread: Like a Kid in a Candy Store... But Now I Need Some Help

  1. #1
    Join Date
    Apr 2010
    Location
    Oakland, California; USA
    Posts
    340

    Default Like a Kid in a Candy Store... But Now I Need Some Help

    The title pretty much says it all, but now for the specifics:

    I'm a bit of a data geek. Meaning I like mounds of data while I'm flying, whether I think I could actually use it or not. Getting it to read out while I fly I find fascinating. Now I'm not the sort of person who necessarily wants to mount gauges to my panel permanently (though I really ought to learn to do that too). But I like to make the stand-alone gauges that I can power up using the SHIFT + (1-9) sequence. That way I can see them... even in spot view if I'd like.

    I began last week on a quest to find a digital thermometer gauge that read in degrees Fahrenheit and gave me ambient outside air temperature (without the TAT correction associated with airspeed). I was successful in my quest in the form of a free download gauge that did just that. Now it was crucial that what I found was an .xml/.bmp combination, instead of a .gau. That way I could open the .xml, pick apart the code, and try to learn from it. So that's what I did, changing the font and color of the numerals to suite my taste.

    Just a note to the community: Yes... I know that reverse engineering other people's work is a big no-no. I would never try to create a gauge from someone else's .xml file that was partially altered, change the label on the .bmp file, and then upload it as my own to the library. This is purely in the privacy of my own home, just so I can learn how the process works, and I can get data sets as I fly that Microsoft doesn't provide in those big default numbers along the top of the screen.

    Then I thought to myself-- well gee... why stop there? If I find out what other data commands exist maybe I can make all sorts of digital gauges that tell me all sorts of stuff... using the original OAT gauge and bitmap as my template.

    So then I checked out the SDK for panels and gauges, and discovered the Parameter.doc... and I was literally all excited like a kid in a candy store. There before my very eyes was all the command line codes that go in the "A:" line of the .xml file! All I had to do was replace the line "Ambient Temperature" with any number of commands, and I now have a new piece of data that reads out in the digital field where the temperature used to be. Some of the ones of particular interest to me are:

    Altitude AGL
    Elevation of Ground Below
    Ground Speed relative to earth's surface
    Distance Traveled
    True Heading
    Plane Pitch Degrees
    Plane Bank Degrees

    That's just a few for now.

    I gave each a test in the field of the OAT gauge just to see if it would work and they were indeed functioning.

    However some did not give me quite the numbers I was looking for and now I'd like to tweak. The problem is I know really nothing about C (+++) programing, so the Boolean string thing is not really my thing. I just like to reverse-engineer other people's examples of .xml files and try to make my own from there. In some cases, a whole new .xml file script (that has nothing to do with the OAT gauge I derived it from) would probably be better. But until I learn more about this process, making a totally different data gauge from a temperature gauge will have to suffice.

    Here are the specific problems I'm having:

    1. I want pitch-angle to read so that UP is POSITIVE and DOWN is NEGATIVE. The polarity is reversed in the command "Attitude Indicator Pitch Degrees", and it reads up as negative and down as positive. How do I reverse it? Is there some kind of command to tell it to take the value and multiply it by negative-1, so I get the polarity the way I want it?

    2. Same goes for "Attitude Indicator Bank Degrees". I want it to read RIGHT is POSITIVE and LEFT is NEGATIVE, and it has those reversed as well.

    3. I want my GROUND VELOCITY in Miles Per Hour, but my units choices (per the Units.doc in the SDK) are only...

    ...• meter/second
    • meter per minute
    • feet/second
    • feet per second
    • feet/minute
    • feet per minute
    • kilometer/hour
    • kilometer per hour
    • knot

    If I know the multiplier to convert knots to MPH, is there a way to tell it knots, but to include a "multiply by 1.15077945" command in the .xml file to make it do that for me?

    I know where I want to get to. I just don't know quite how to word it in the .xml file to make it do that.

    Here's a sample of the .xml text. Please ignore the fact that it's originally an .xml file for a digital OAT gauge. Many of the OAT commands I didn't change, but I had to start with something I could work with.

    Thank you.

    ===================================

    <Gauge Name="UMA OAT" Version="1.0">
    <Image Name="UMA_OAT_b.bmp" />

    <Element>
    <Visible>(A:Circuit General Panel on,bool)</Visible>
    <Position X="24" Y="77" />

    <Element>
    <Position X="0" Y="-2" />
    <Text X="90" Y="50" Length="4" Font="Arial Black" Color="Light Blue" Adjust="Right" Bright="Yes">
    <String>%((P:UNITS OF MEASURE, Enum) 0 == )%{if}%((A:Attitude Indicator Pitch Degrees, degree))%!2d! %{else}%((A:Ambient Temperature, Celsius))%!2d! %{end </String>
    </Text>
    </Element>

    <Element>
    <Position X="110" Y="-2" />
    <Text X="45" Y="50" Length="2" Font="Arial Black" Color="Light Blue" Bright="Yes">
    <String>%((P:UNITS OF MEASURE, Enum) 0 == )%{if} F %{else} C %{end</String>
    </Text>
    </Element>
    </Element>

    </Gauge>
    MSFS 2004 v9.1; Windows 7 Ultimate 64-bit
    AMD FX 8120 8-core processor 4.3Ghz, XFX R7870 2GB GDDR5, Corsair Vengeance 8GB 1600, Western Digital 500GB HDD, Biostar A880GZ AM3+, Antec Kuhler 620 water cooling

  2. #2

    Default

    XML uses "Reverse Polish Notation" which is to say that it uses the early Hewlet-Packard calculator input method where the parameters come first, followed by the operator. For example, to add two numbers you'd enter:
    100 200 +
    Multiplication, 100 200 *
    etc.

    So, to negate any parameter value, multiply by -1

    (A:SomeParameter,unit) -1 *

    To multiply by some fixed scalar value:

    (A:SomeParameter,unit) 1.78323 *

    For Ground Speed in MPH, simply use the "units" parameter appropriate for that:

    (A:GROUND VELOCITY,mph) (or "mile per hour" or "miles per hour")

    alternatively you can also try

    (A:GPS GROUND SPEED,mph)
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  3. #3
    Join Date
    Apr 2010
    Location
    Oakland, California; USA
    Posts
    340

    Default

    Quote Originally Posted by n4gix View Post
    XML uses "Reverse Polish Notation" which is to say that it uses the early Hewlet-Packard calculator input method where the parameters come first, followed by the operator. For example, to add two numbers you'd enter:
    100 200 +
    Multiplication, 100 200 *
    etc.

    So, to negate any parameter value, multiply by -1

    (A:SomeParameter,unit) -1 *

    To multiply by some fixed scalar value:

    (A:SomeParameter,unit) 1.78323 *

    For Ground Speed in MPH, simply use the "units" parameter appropriate for that:

    (A:GROUND VELOCITY,mph) (or "mile per hour" or "miles per hour")

    alternatively you can also try

    (A:GPS GROUND SPEED,mph)
    Thank you so much! It worked, after I tweaked it and figured out what didn't work first. I don't know if the proper term for this is Boolean, or C, or C+, or C++, or C+++ , but either way I've discovered that it can be very unforgiving if you don't get the characters exactly right.

    First off, I can tell you that MPH or miles per hour does not work at all. That American ground transportation standard is not even recognized as an acceptable standard as units of speed within the MSFS SDK. My guess is because there's never really been a standard for using anything other than knots in the aviation industry.

    So I'll have to use a multiplier to convert kts to mph, and I thank you for your advice on using the reverse polish notation. Multiplier # followed by * does do the trick, but I had to experiment with the format to get it to work. There appears to be a very set allocation of spaces vs. no spaces between the end parenthesis, the multiplier value and the * that needs to be just right, or it won't work.

    (A:Parameter, unit)[ mandatory space]#[mandatory space]*[optional space if 2nd set of parenthesis])... Is apparently the way it has to be. Once I got that straight, it worked and I'm home free!

    Now I can apply the multiplier of 1.15077945 to convert the knots to mph. And I can apply the multiplier of -1 to the bank and pitch angle to reverse the polarity of those measurements-- so that pitch up is positive and bank right is positive.

    By the way, I found out why the polarity of the pitch and bank data appeared reversed. It's because those parameter commands are not designed to be used as data output for a DIGITAL GAUGE. They are designed to be used in conjunction with an artificial horizon display. And by the nature of that display, a bank right will rotate the artificial horizon display to the left (the negative direction), and a pitch up will move the blue sky display down toward the center-line (the negative direction). That's why the raw numbers appeared to be negative-up, negative-right... which seemed counter-intuitive to me at first.

    I had not thought about that earlier, but once it hit me, it made all the sense in the world!

    Thank you again for your help.

    -- John
    MSFS 2004 v9.1; Windows 7 Ultimate 64-bit
    AMD FX 8120 8-core processor 4.3Ghz, XFX R7870 2GB GDDR5, Corsair Vengeance 8GB 1600, Western Digital 500GB HDD, Biostar A880GZ AM3+, Antec Kuhler 620 water cooling

  4. #4

    Default

    Yes, spaces are indeed critical! Back in the "Dark Ages" when real programmers actually created logic flowcharts, and then wrote out our entire code with pencil and paper, we used a "slashed b" to indicate a "blank space." Unfortunately, computer keyboards have no such character...

    ..so we are faced with an untenable problem when posting "code snippets" here in the forum because we have no way of identifying those critical blank spaces!

    Further compounding the problem with XML is that there are different syntactical rules in effect depending on just where we are working! For example, in a <Text> or <FormattedText> section the simple "if" becomes {if} and "else" becomes {else}...

    ...whereas anywhere else in the script the "rules change" such that "if" becomes if{ ... } and "else" becomes els{ ... }

    Note in the latter instance I've used three periods to represent the "contents" that will go between the opening and closing curly-braces, such that the required blank space is clearly shown.

    As for the "mph" unit identifier, whether that works or not depends on whether you are working for FS9 or FSX. If FS9 then at that time "mph" was not supported. It was only added at the time of FSX's release.

    More fun is to be had when parsing out logical operators and how they are applied to evaluations. In simple terms, logical operations are carried out in sequence from left to right, and apply only to the two immediately preceding operations... For example the sequence:
    Code:
    (A) (B) and (C) or
    
    /* NOTE: this could also "legally" be written as below, but the logic is far less clear! /*
    
    (A) (B) (C) and or
    When evaluated, (A) will be "and'ed" with (B), then the result of that operation will be "or'ed" with (C).

    So:
    1. (True) (True) and = (True)
    2. (False) (True) and = (False)
    3. (True) (False) and = (False)
    4. (False) (False) and = (False)


    Next:

    1. (True) (True) or = (True)
    2. (False) (True) or = (True)
    3. (True) (False) or = (True)
    4. (False) (False) or = (False)


    I don't know whether this will be helpful or simply confusing.
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  5. #5

    Default

    By the way, when posting script here in the forum, if you use the "Advanced Editor" you will see a # icon in the top menu bar. If you highlight your code script then click on that icon, it will be wrapped in a set of [code] tags so that formatting and indenting are preserved.
    Code:
    <Element>
         <Position X="0" Y="-2" />
         <Text X="90" Y="50" Length="4" Font="Arial Black" Color="Light Blue" Adjust="Right" Bright="Yes">
         <String>%((P:UNITS OF MEASURE, Enum) 0 == )%{if}%((A:Attitude Indicator Pitch Degrees, degree))%!2d! %{else}%((A:Ambient Temperature, Celsius))%!2d! %{end}</String>
         </Text>
    </Element>
    Also, if you add some carriage returns (Enter key) just at the % entries, you can expand the <String> to make it easier to read and understand!
    Code:
    <Element>
         <Position X="0" Y="-2" />
         <Text X="90" Y="50" Length="4" Font="Arial Black" Color="Light Blue" Adjust="Right" Bright="Yes">
           <String>
              %((P:UNITS OF MEASURE, Enum) 0 == )
              %{if}
              %((A:Attitude Indicator Pitch Degrees, degree))
              %!2d! 
              %{else}
              %((A:Ambient Temperature, Celsius))
              %!2d! 
              %{end} 
           </String>
         </Text>
    </Element>


    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  6. #6
    Join Date
    Apr 2010
    Location
    Oakland, California; USA
    Posts
    340

    Default

    Cool! Thanks for the advice.

    As for MPH... you're right, I am working in FS9, so there was no direct parameter for it. But knots * 1.15 etc. etc. (can't remember the rest of it) will easily convert kts to mph. I'm satisfied with that. One might wonder why I want a ground speed gauge that reads MPH in a jetliner? Well I don't fly in real life, I just do it on the sim. My only experience with transportation (that I can relate it to) is driving in my car-- where my speedo reads in MPH. Therefore as I fly I guess I'd like to know how that translates into something I'm already familiar with; as well as gain a sense of how long it will take me to get to an airport a known distance away if I know real ground speed. Knowing I'm cruising at 290kts at flight level 300 is great... but what does that translate into as compared to the cars 6 miles below on the interstate? Well... now I know.

    I was hoping you wouldn't mind fielding a few more questions while we're on topic:

    1. Now that I've discovered the gauge parameters page in the gauge and panel SDK, I'd like to try to jam a ton of those onto my window views. (For sh*ts & giggles if for nothing else-- just to prove I can do it I guess). My question is when writing extended window view lines in the aircraft panel.cfg text, is there a way to go beyond [Window 08] (view key combination "SHIFT + 9"), so that I can open more windows for my gauges... or does the sim stop at Window 8 no matter what?

    2. Using the text code I borrowed from that Outside Air Temperature gauge I downloaded from Mr. Pierre Fasseaux's collection (I guess I'd like to give the man credit where the credit is due, since I've shared his .xml code on the forum), I'd like to know how I would go about constructing a digital clock that would insert hours : minutes : seconds-- with the colons in between as part of the gauge text? I found the parameter code for local time and zulu time, and I learned that the lead letter before the script colon has to be transferred from an A: (meaning airplane) to either an E: (environment), or a P: (program), in order for the clock to work. But here's the problem-- my units can only be either hours, minutes, or seconds. I don't know how to run all three of them together in sequence to read like a real digital clock. And I don't want to put three stand alone gauges side by side where the one on the left reads hours, the one in the middle reads minutes, and the one on the right reads seconds-- because that would be really stupid. If you could point me in the right direction... I would appreciate it.

    Thanks.
    Last edited by b3burner; 06-23-2012 at 07:44 PM.
    MSFS 2004 v9.1; Windows 7 Ultimate 64-bit
    AMD FX 8120 8-core processor 4.3Ghz, XFX R7870 2GB GDDR5, Corsair Vengeance 8GB 1600, Western Digital 500GB HDD, Biostar A880GZ AM3+, Antec Kuhler 620 water cooling

  7. #7

    Default

    Here is another resource for basic gauge creation: http://www.fs2x.com/Tutorials.htm

    There you will find all manner of information that will be useful.

    Also, don't be afraid to "unzip" any of the FS9 .CAB files you have and study them for inspiration! When unzipped, be sure that the folder name remains the same as the "Gauge.CAB" name...

    In fact, if I remember correctly the clock.xml file in the Beech_Baron.cab file has what you're wanting...
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  8. #8
    Join Date
    Apr 2010
    Location
    Oakland, California; USA
    Posts
    340

    Default

    Quote Originally Posted by n4gix View Post
    Here is another resource for basic gauge creation: http://www.fs2x.com/Tutorials.htm

    There you will find all manner of information that will be useful.

    Also, don't be afraid to "unzip" any of the FS9 .CAB files you have and study them for inspiration! When unzipped, be sure that the folder name remains the same as the "Gauge.CAB" name...

    In fact, if I remember correctly the clock.xml file in the Beech_Baron.cab file has what you're wanting...
    Thank you. That website for the fs2x has been my bible for much of the past 3 days as I've been working on it. Problem is I haven't quite read it cover to cover, but rather skim for the specific information I'm looking for.

    I'm finding that it does a good job of explaining thing like how to create places to the left and right of the decimal. What it seems to lack (unless you can tell me where to find it), is the parameter prefixes A:, P:,E:, etc. and what parameters belong to each. I thought I found that somewhere on Friday, and now I can't find it anymore.

    As for the Beach Baron... thanks. I'll check it out. Many of these planes use .gau files, which of course I can't open and look at the text. But if it's an .xml in a .cab... then I'm able to learn as I go. If the Beach Baron has an .xml for a digital clock, I'll definitely have to check it out.

    The funny thing here is that I'm not even trying to make artistically correct gauges with varying .bmp's. I'm just using one model of .bmp and .xml from a digital temp gauge I happened to find, and now I'm trying to make that one source of code meet all my needs. Probably pretty rookie in nature, but I figure I gotta' start somewhere.
    MSFS 2004 v9.1; Windows 7 Ultimate 64-bit
    AMD FX 8120 8-core processor 4.3Ghz, XFX R7870 2GB GDDR5, Corsair Vengeance 8GB 1600, Western Digital 500GB HDD, Biostar A880GZ AM3+, Antec Kuhler 620 water cooling

  9. #9

    Default

    The parameter prefixes (A: P: E: etc.) are enumerated in the FSX SDK. However, there are only a handful that are not A:...

    Environment Data (E: type)

    ABSOLUTE TIME (Time, as referenced from 12:00 AM January 1, 0000)*
    ZULU TIME
    ZULU DAY OF WEEK
    ZULU DAY OF MONTH
    ZULU MONTH OF YEAR
    ZULU DAY OF YEAR
    ZULU YEAR
    LOCAL TIME
    LOCAL DAY OF WEEK
    LOCAL DAY OF MONTH
    LOCAL MONTH OF YEAR
    LOCAL DAY OF YEAR
    LOCAL YEAR
    TIME ZONE OFFSET
    TIME OF DAY

    Program Data (P: type) are only these two:

    SIMULATION RATE
    UNITS OF MEASURE

    *NOTE: Essentially "elapsed seconds" since 12:00 AM January 1, 0000, which is as you may well imagine, a truly HUGE number! Not that it matters one bit to us, an interesting bit of trivia is that....

    ...At 03:14:08 UTC on 19 January 2038, 32-bit versions of the Unix time stamp will cease to work, as it will overflow the largest value that can be held in a signed 32-bit number. Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems
    Last edited by n4gix; 06-25-2012 at 02:36 PM.
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Similar Threads

  1. What would you like to see in the MSFlight Store?
    By Paxx in forum Microsoft Flight
    Replies: 17
    Last Post: 01-24-2012, 04:25 PM
  2. Rig specs almost determined, but need some graphics card help
    By dfreemanfso in forum PC Hardware, Video And Audio Help
    Replies: 8
    Last Post: 04-15-2011, 07:06 AM
  3. Replies: 5
    Last Post: 08-24-2005, 10:06 PM
  4. New "Kid" Here Need a Little Help re:VOR
    By downeaster in forum FS2004
    Replies: 13
    Last Post: 08-23-2005, 06:50 PM
  5. Replies: 1
    Last Post: 01-25-2002, 04:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •