Need help with 2 syntax issues...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Need help with 2 syntax issues...

  1. #1
    Join Date
    Sep 2008
    Posts
    6

    Need help with 2 syntax issues...

    Hello all:
    I'm doing some XML work in Microsoft Flight Simulator, and I'm having trouble with two issues. I'm not very good at XML, just hacking my way through.

    [1] I assign the value of a standard variable (Airspeed) to a unique variable (Aspd) for display later on.
    <Element><Select>
    <Value>(A:Airspeed Indicated,knots) (&gt;L:Aspd,number)
    </Value></Select>
    </Element>


    This works just fine...the value of Airspeed is forced into Aspd. BUT...let's say I want to add some chosen value to Airspeed before I stuff it into Aspd (Say 15, just for example). So...if the actual Airspeed was 200, when I display Aspd it would show 215. Can't figure out the syntax for this.

    [2] Flight Sim has tons of output variables that show various aircraft parameters, such as: Airspeed, Altitude, Vertical Speed, Fuel Flow, Flaps Position...hundreds of them. There are instances when I need to ADD the value of one variable to another (or SUBTRACT it from another), and assign the results to a unique variable. Let's say, for example, that my target Autopilot Altitude (A:AUTOPILOT ALTITUDE LOCK VAR,feet) is 10,000 feet, and my actual Altitude (A:PLANE ALTITUDE, feet) is 8,000 feet. How would I subtract actual from target, and assign the results to a unique variable (say, L: AltDiff)?


    Thanks in advance for any help you can offer.

    Garry

  2. #2
    Join Date
    May 2009
    Location
    United Kingdom
    Posts
    49
    When you say "doing some XML work", what are you using to do the modifications?
    A programming language like C#? Or something that compliments XML like XSLT?

    Either way some samples from your current code base would be useful...

  3. #3
    Join Date
    Sep 2008
    Posts
    6

    RE: XML and Flight Simulator??

    Hi Reedy837:
    Not sure I can answer your questions correctly, since I’m not a professional programmer, but I’ll try to be more explanatory. First of all, you’re correct…everything I do with XML involves MS Flight Simulator. Yes, we do use input and output variables that are unique to Flight Sim, such as (A:Airspeed Indicated,knots) which shows the aircraft altitude, (A:Indicated Altitude,feet) shows the altitude above sea level,
    <Click Event="TOGGLE_MASTER_BATTERY"/> used to toggle the master battery off.on, etc…there are hundreds of these input/output variables. Far as I’m told, the code used to display information from the Flight Sim variables (in digital form, or to rotate a needle, or some other format, etc), or to cause some action within the aircraft (turn something on or off, set a specific value, etc)…is just plain old XML. I use Windows Notepad as an XML editor (along with my own BMP images) to create or modify an XML gauge or instrument. There are probably other editors, but this is how I was taught.Shown below is an Airspeed gauge that works in Flight Sim . (My comments are in RED).

    =========================================================
    Code:
    <Gauge Name="Beech-18 Airspeed Gauge" LiewAire Virtual Airlines ">
       <Image Name="B18-Airspeed-Backing.bmp" ImageSizes="158,158,0,0"/>
    ** Here, I'm just saying to put an ima down first (B18-Airspeed-Backing) and place everthing else below on top of that image **
       
                           <!-- Display Airspeed -->
    
          <Element>
          <Position X="50" Y="50"/>
          <Image Name="B18-Airspeed-Needle.bmp" PointsTo="East">
             <Axis X="30" Y="4"/>
          </Image>  ** Here I'm telling the code which image (B18-Airspeed-Needle.bmp) to use for the needle...I'm tellit precisely where to position it (X=50 and Y=50) on the primary background image, and I'm declaring the precise AXIS (center of the needle) in pixels. **
    
          <Rotate>
             <Value Minimum="0" Maximum="300">(A:Airspeed Indicated, knots)</Value>
    
             <Failures>
                <SYSTEM_PITOT_STATIC Action="0"/>
                <GAUGE_AIRSPEED Action="Freeze"/>
             </Failures>  ** Airspeed gauges rely on static pressure from the PITOT TUBE mounted outside the aircraft.  This code says that if the Pitot Tube is plugged with ice or other debris, set the Airspeed needle to ")" and freeze it there until the Pitot Tube is functional. **
    
             <Nonlinearity>
                <Item Value="0" Degrees="270"/>
                <Item Value="40" Degrees="286"/>
                <Item Value="80" Degrees="337"/>
                <Item Value="94" Degrees="0"/>
                <Item Value="105" Degrees="17"/>
                <Item Value="120" Degrees="41"/>
                <Item Value="151" Degrees="90"/>
                <Item Value="180" Degrees="138"/>
                <Item Value="209" Degrees="180"/>
                <Item Value="230" Degrees="199"/>
                <Item Value="248" Degrees="215"/>
                <Item Value="300" Degrees="250"/>
             </Nonlinearity>  
             <Delay DegreesPerSecond="50"/>
          </Rotate>
       </Element>  ** Here (above)  I tell it to READ a variable (A:Airspeed Indicated, knots), I'm telling it that the scale I'll use is 0-300, I'm telling it to ROTATE the needle to a specific degree based on output from the variable, and I'm telling it to rotate it slowly <DELAY...>(life-like versus instantaneous) **
    
    
    </Gauge>
    =========================================================


    Why do we need to create gauges/instruments in XML? For two reasons: One, Flight Sim does provide a list of “standard gauges/instruments, which were designed with Microsoft proprietary language and create a (.GAU) extension. Absolutely untouchable, no way to open them or modify them…you can use them exactly as they are, but that's all. Two, sometimes we need a gauge or instrument that Microsoft does not offer.

    I’m attaching two images of instrument panels: One shows a a Flight Sim instrument panel for the Cessna 172, using standard Flight Sim gauges & instruments…I can use these gauges on a different panel, but they will look & perform exactly as these do. The other image is a custom instrument panel that I created for the Shorts-360B, part of our fleet (the Shorts is a third-party aircraft not offered by Flight Sim). I created every gauge and instrument for this panel using XML code and my own BMP images. With this I have total control…I can make a gauge look and perform however I wish.


    I hope this clears things up a bit. If you have any further questions, please feel free to ask. If you want a complete package of all gauges/instruments for one aircraft, let me know and I’ll make it available. There’s a wide variation in functionality…some gauges just read and display a variable in digital text, some gauges make a needle rotate, some gauges “DO” something to the aircraft, such as: Raise/lower the landing gear, or the Flaps, or turn a switch on/off.

    Garry
    Attached Images Attached Images
    Last edited by Hack; 01-12-2011 at 01:51 PM. Reason: Added Code Tags

  4. #4
    Join Date
    May 2009
    Location
    United Kingdom
    Posts
    49
    Sorry, but I will not be able to help...I know nothing about MS Flight Simulator or their syntax (whether its XML or otherwise). Does MS Flight Simulator not have a forum of it's own where other people who have worked with MS Flight Simulator might be able to help!?

Similar Threads

  1. Looking for a Javascript pro to help work out web application issues
    By Freelancer.Internet.com in forum Careers
    Replies: 0
    Last Post: 08-25-2009, 10:10 PM
  2. SQL Statement
    By shers in forum Database
    Replies: 4
    Last Post: 06-17-2006, 05:01 AM
  3. Replies: 5
    Last Post: 04-09-2006, 09:28 PM
  4. VB6 vs VB.NET...Procedure Calling Syntax
    By Patrick Troughton in forum .NET
    Replies: 78
    Last Post: 08-13-2002, 12:18 PM
  5. Replies: 16
    Last Post: 08-12-2002, 11:06 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center