View Single Post
  #1  
Old 09-30-2011, 10:12 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default getParameter - extended DeviceLink replacement

Attached is a list of parameters that can be inquired by a script from the CloD engine as in the following example:

float health = (float)aircraft.getParameter(part.ParameterTypes.M _Health, -1);

This allows creation of instruments panels on external monitors, virtual cockpits, etc.

Sample from naryv for offline use (prints out TAS and alt)
Code:
using maddox.game;
using maddox.game.world;

public class Mission : AMission
{

    System.IO.FileInfo fi = new System.IO.FileInfo("indicators.txt");
    System.IO.StreamWriter sw;            

    public override void OnTickGame() {
      base.OnTickGame();
      if (Time.tickCounter() % 30 == 1)               // tick ~ 1/30 second, 30 ticks ~ 1 second
      {
          AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft; // get player aircraft
          if (curPlane != null)
          {
              double i_IAS = curPlane.getParameter(part.ParameterTypes.I_VelocityIAS, -1); // get TAS and alt.
              double i_IAlt = curPlane.getParameter(part.ParameterTypes.I_Altitude, -1);
              System.Console.WriteLine("IAS :{0}", i_IAS);                   // write to console
              System.Console.WriteLine("Alt :{0}", i_IAlt);

              sw = fi.AppendText();                                       // write to file
              sw.WriteLine("Time:{0}",Time.currentReal());
              sw.WriteLine("IAS :{0}", i_IAS);
              sw.WriteLine("Alt :{0}", i_IAlt);
              sw.Close();
          }
      }
}

}
Attached Files
File Type: zip GetParameterParameters.zip (6.9 KB, 143 views)

Last edited by Ataros; 10-05-2011 at 08:43 AM.
Reply With Quote