Creating my own variables

Barney_LM
Posts: 46
Joined: Tue Apr 03, 2018 10:49 am

Creating my own variables

Postby Barney_LM » Mon Jun 04, 2018 3:40 pm

Hello

Are you able to create your own variables for Prepar3d and then reference them in HUD / GPS.xmls?

Eg. using: (A:<Your own variable>, degrees)

Regards,

Barney

N4GIX
Posts: 582
Joined: Wed Dec 08, 2010 6:52 pm

Re: Creating my own variables

Postby N4GIX » Mon Jun 04, 2018 3:59 pm

Not like that, no. All custom XML variables follow this format:

(L:MyCustomVariable,unit) where unit = bool, enum, or number
Bill Leaming
Modeler and Programmer
Military Visualizations

Barney_LM
Posts: 46
Joined: Tue Apr 03, 2018 10:49 am

Re: Creating my own variables

Postby Barney_LM » Mon Jun 04, 2018 4:06 pm

Ok

So could I make my own variable in my C# code in my winform

Then set it to a custom SimConnect variable

And then reference it in an xml?

Barney

Barney_LM
Posts: 46
Joined: Tue Apr 03, 2018 10:49 am

Passing my own variables to SimConnect and then to

Postby Barney_LM » Tue Jun 05, 2018 9:49 am

I have created my own dynamic variables in my C# winform which are the latitude and longitude for a target

I want to pass the values of these variables to my Aircraft data via SimConnect

I have created shape for my HUD.xml

Then I want to be able to use the values of these variables in my HUD.xml so that the shape locks onto the target position

Could someone explain how I would go about doing this?

Regards,

Barney

Barney_LM
Posts: 46
Joined: Tue Apr 03, 2018 10:49 am

Changing a simulation variable

Postby Barney_LM » Tue Jun 05, 2018 12:29 pm

In SimConnect I am trying to change the GPS IS ACTIVE WAY POINT to be true

I have added this property to the Definition Data like so:

Code: Select all

simConnect.AddToDataDefinition(DEFINITIONS.AircraftData, "GPS IS ACTIVE WAY POINT", "bool", SIMCONNECT_DATATYPE.INT32, 0, SimConnect.SIMCONNECT_UNUSED);
And have attempted to change it as demonstrated in the code sample below

Code: Select all

s1.isActive = true; imConnect.SetDataOnSimObject(DEFINITIONS.AircraftData, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, s1.isActive);
Is it actually possible to change a simulation variable even though it may not be settable?

Please advise

Barney

User avatar
Brady Butler
Lockheed Martin
Posts: 483
Joined: Tue May 09, 2017 5:31 pm

Re: Creating my own variables

Postby Brady Butler » Tue Jun 05, 2018 12:33 pm

Hello,

I merged your topics since they are all related.

Regards,
Brady
Brady Butler
Prepar3D® Software Engineer

Clifton Crane
Lockheed Martin
Posts: 838
Joined: Tue Sep 25, 2012 2:34 pm

Re: Creating my own variables

Postby Clifton Crane » Tue Jun 12, 2018 5:02 pm

Hi Barney,

For simulation variables that are not settable, there is typically an associated KEY_EVENT that can be triggered to modify values. Have you had a look at the SimConnect_MapClientEventToSimEvent function? This can be used to trigger key events from a SimConnect application.

In addition to L:Vars, developers can also create custom gauges variables (C:Vars). The Mixed Mode Sample in the SDK shows how to define C:Vars. Also, the gauges.h header and Panel PDK Service both have the ability to set/get L:Vars, but these options are limited to C++ and are not available in C#.

Hope this helps!
Clifton Crane
Prepar3D® Software Engineer


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 5 guests