PDA

View Full Version : getParameter - extended DeviceLink replacement


Ataros
09-30-2011, 10:12 AM
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)
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_Veloci tyIAS, -1); // get TAS and alt.
double i_IAlt = curPlane.getParameter(part.ParameterTypes.I_Altitu de, -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();
}
}
}

}

bolox
10-02-2011, 08:48 PM
thanks for this- made life alot easier to see how they've done things- there's many more 'parameters' to play with than old IL2 devicelink- very extended:-P

i'm very new to this scripting lark but managed to get some bombsight parameters writing to screen:-P

this does lead me to think that if any efforts are to be made in this direction there is a decision to be made with the output, i feel, there being a choice with separate instrument gauge and model instant values available for some params- chart makers will want one set, instrument replicators wanting another set- or start from scratch with a new protocol. any thoughts?

salmo
10-03-2011, 06:11 PM
Can this be used to create a speedbar like in IL2-1946? ie speed, altitude & heading?

bolox
10-03-2011, 07:10 PM
http://simhq.com/forum/ubbthreads.php/topics/3347984/Re_Is_it_possible_to_make_airs.html#Post3347984

i;ve just changed a few things to read other params

Ataros
10-05-2011, 08:38 AM
Updated the 1st message with a sample from naryv.

KeBrAnTo
10-20-2011, 10:45 AM
Great finding Ataros, now I've got the subject quite clear and I think with a litle bit of programming an interface it would be quite simple to make external gauges work, either in a second monitor or using phidgets I think. :grin:

I'll start coding a little bit tonite to see what are exactly the possibilities that open up doing the things like this.

Great news.

KeBrAnTo
10-20-2011, 11:23 AM
Sorry, I think I've seen it in another of your posts Ataros, but I cannot find it now so could you please tell me which are the dll's containing the maddox.game namespace?

Thanks in advance.

Ataros
10-20-2011, 11:40 AM
Do you mean this post?
Visual Studio will let you see all of the methods in roundabout way. Try this:

1. File >> New >> Project Type in a name and solution name at the bottom. Don't worry about what kind of project you create.

2. On the right side under "Solution Explorer", right click on "References", "Add Reference..."

3. Click on the "Browse" tab, navigate to "Steam/steamapps/common/il-2 sturmovik cliffs of dover/parts/core"

4. Go through each .dll file in that list and try to add it. Some will give you an error, just skip those.

After you've added all the .dll files, right click on the name of your project and do "Add Existing Item". Find one of your script files and add it. Now Visual Studio will show you all the possible methods as you're typing your code. You can also go to View >> Object Browser and have a look in there.

Important: When you import an existing item, Visual Studio makes a copy of the file so any changes you make won't be reflected in the original file, you'll have to copy the new one over it. If anybody knows how to change this, I'd be quite grateful.

KeBrAnTo
10-20-2011, 12:16 PM
Yes, thanks mate :)

Tex-Twil
01-18-2012, 01:59 PM
the following example:



Hi,
which programming language is this and what how do I make CoD execute it ?

EDIT: ok I got it. It's C#. But this works only for custom missions, right ? http://simhq.com/forum/ubbthreads.php/topics/3347984/2.html


thanks,
Tex