1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FS2004 Reading altitude from FS2004 (FSUIPC)

Discussion in 'Tools programming' started by Mikock, 28/3/10.

  1. Mikock

    Mikock

    Joined:
    27/8/05
    Messages:
    36
    Good day!

    I am writing a small tool for my Flight Simulator.
    It should log some flight data.

    I am using the development language C#Sharp. With the help of FSUIPC I am trying ti get the data from the simulator. Some data works very good like airspeed, heading or lights switching.
    Today I have tried to read out my actual altitude.
    In FSUIPC there are some variables to get them (e.g. 0x0020 or 0x0570)
    But in this case I am only getting very strange values. I am cruising on 38000ft and I am only getting value = 0 :confused:
    When I am climbing to another level, I will get other strange values. It will change every second.

    Does anybody have an idea?

    Here are some code of it:

    Code:
    
    [...]
    
    //Getting values from FSUIPC
    Offset<double> agl = new Offset<double>(0x0570);
    
    [...]
    
    //Transforming in feets
    double valagl = agl.Value * 3.28084 / (65536 * 65536);
    
    //Printing in label
    this.lblAGL.Text = valagl.ToString("f0");
    
    [...]
    
    
    Thanks!
  2. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    23,295
    Country:
    wales

Share This Page