I am working on making a small script that tries to reproduce a sort of very basic aircraft black box but there are some things that I can't figure out by myself so I need a bit of help from the more expert programmers ( I have a very minimal experience in scripting )
Said so my question are:
1)- I can find easily the Instrumentation ParamType of an aircraft instrument ( for example taking it from Virtual Cockpit files ):
Sample ( Elevator Trim ):
Code:
double A_ElevatorTrim = curPlane.getParameter(part.ParameterTypes.A_ElevatorTrim, -1);
But where I can find the other parameters of the instruments that are located in the " Parameters - Machine Spatial " section of the script? Is there a complete list of them available around? From where do you get them?
Samples:
Code:
double Z_Overload = curPlane.getParameter(part.ParameterTypes.Z_Overload, -1);
double Z_AltitudeAGL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeAGL, -1);
double Z_AltitudeMSL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeMSL, -1);
double Z_VelocityIAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityIAS, -1);
double Z_VelocityTAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityTAS, -1);
double Z_VelocityMach = curPlane.getParameter(part.ParameterTypes.Z_VelocityMach, -1);
double Z_AmbientAirTemperature = curPlane.getParameter(part.ParameterTypes.Z_AmbientAirTemperature, -1);
2- I would like to add to the script also the right and left engine water temperature ( Bf 110 )...how can I do it? I mean, the ParamType is I_EngineWatTemp but how I let the script recognise/distinguish the left one, from the right one?
3- The script works on a dedicated Lobby but not online on a public server...Is there a way to let it work online too? If yes, what I have to modify/edit in the script? ( I'm asking this because I would like to start to use a script instead of Virtual cockpit that drains precious resources anf FPS from my PC, if possible )
4- Once I run the mission on the dedicated Lobby the yellow, capital on screen message is displayed at the top of the screen...How can I move it to the bottom of the screen instead? Is it possible to change the colour in which the writings are displayed? ( In medium blue for example )
Below there is the script I'm currently using. If you want/can help me, please, in your reply report/post the script already correctly edited by you ( due to my inexperience in scripting ), thanks!
Thanks in advance to all the ones that will help me!!! ;)
The Script I'm Currently Using
Code:
using System;
using System.Threading;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;
public class Mission : AMission
{
//flag
bool done = false;
//Create Stream
System.IO.StreamWriter sw;
//Strings
string str_log = System.String.Empty;
string str_hud = System.String.Empty;
//Create Log File
System.IO.FileInfo fi = new System.IO.FileInfo("C:\\FLIGHT_TEST_DATA.CSV");
//Script Main
public override void OnTickGame()
{
//Init Ticker
base.OnTickGame();
//loop rate set to ~1/30th of a second, i.e. 30 ticks = ~1 second
if (Time.tickCounter() % 30 == 1)
{
//Get player aircraft
AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft;
if (curPlane != null)
{
//Instrumentation - Machine Spatial
double I_VelocityIAS = curPlane.getParameter(part.ParameterTypes.I_VelocityIAS, -1);
double I_Altitude = curPlane.getParameter(part.ParameterTypes.I_Altitude, -1);
double I_Variometer = curPlane.getParameter(part.ParameterTypes.I_Variometer, -1);
double I_MagneticCompass = curPlane.getParameter(part.ParameterTypes.I_MagneticCompass, -1);
double A_ElevatorTrim = curPlane.getParameter(part.ParameterTypes.A_ElevatorTrim, -1);
//Parameters - Machine Spatial
double Z_Overload = curPlane.getParameter(part.ParameterTypes.Z_Overload, -1);
double Z_AltitudeAGL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeAGL, -1);
double Z_AltitudeMSL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeMSL, -1);
double Z_VelocityIAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityIAS, -1);
double Z_VelocityTAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityTAS, -1);
double Z_VelocityMach = curPlane.getParameter(part.ParameterTypes.Z_VelocityMach, -1);
double Z_AmbientAirTemperature = curPlane.getParameter(part.ParameterTypes.Z_AmbientAirTemperature, -1);
//Game Time
double dtime = Time.current();
//Log Header
if (done == false)
{
//Write Header
sw = fi.AppendText();
sw.WriteLine("TIME;HEADING;ALTITUDE;IAS;VARIOMETER;ELEVATOR_TRIM;TEMP");
sw.Close();
done = true;
}
//Log Data
str_log = dtime.ToString("0.00") + ";" + I_MagneticCompass.ToString("0.00") + ";"
+I_Altitude.ToString("0.00") + ";"
+I_VelocityIAS.ToString("0.00") + ";"
+I_Variometer.ToString("0.00") + ";"
+A_ElevatorTrim.ToString("0.00") + ";"
+Z_AmbientAirTemperature.ToString("0.00"); //TEMP
sw = fi.AppendText();
sw.WriteLine(str_log);
sw.Close();
//Display HUD
GamePlay.gpHUDLogCenter("TIME: " + dtime.ToString("0.00") +
" HEADING: " + I_MagneticCompass.ToString("0.00") +
" ALTITUDE: " + I_Altitude.ToString("0.00") +
" IAS: " + I_VelocityIAS.ToString("0.00") +
" VARIOMETER: " + I_Variometer.ToString("0.00") +
" ELEVATOR_TRIM: " + A_ElevatorTrim.ToString("0.00") +
" TEMP: " + Z_AmbientAirTemperature.ToString("0.00"));
}
}
}
}
Bookmarks