• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

"PAYLOAD STATION NAME"

DragonflightDesign

Resource contributor
Messages
1,096
Country
northernireland
As a follow-on from my previous question, can anyone confirm if the above is another non-working variable?
Code:
' Create the definition
p3d_simconnect.AddToDataDefinition(P3Data.DefinePayloadStations, "PAYLOAD STATION NAME:1", "string", SIMCONNECT_DATATYPE.FLOAT64, 0, 600)
' Request the payload station name
p3d_simconnect.RequestDataOnSimObject(P3Data.RequestPayloadStations, P3Data.DefinePayloadStations, SIMCONNECT_SIMOBJECT_TYPE.USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, 0, 0, 0)
I'm getting an exception 7 followed by an exception 3, which is what I'd expect if the variable is defective.
 

DragonflightDesign

Resource contributor
Messages
1,096
Country
northernireland
Nope. Still can't Can get it even after correcting the obvious problem.
Code:
' Create the definition
p3d_simconnect.AddToDataDefinition(P3Data.DefinePayloadStations, "PAYLOAD STATION NAME:1", Nothing, SIMCONNECT_DATATYPE.STRING256, 0, 600)
' Request the payload station name
p3d_simconnect.RequestDataOnSimObject(P3Data.RequestPayloadStations, P3Data.DefinePayloadStations, SIMCONNECT_SIMOBJECT_TYPE.USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, 0, 0, 0)
The struct returns 'Nothing' in the stationName1 field.

:duck::tapedshut
 
Last edited:

Dave_W

Resource contributor
Messages
185
FWIW:

Using the C# Managed Data Request sample from the FSX SP2 SDK, I was able to get a station name.

But, it was only one. It can be for any station number.

If I asked for more than one string in this sample, the app would crash.

I've never needed more than one string returned in SimConnect, so I've never tried to see how it is done. And, my lack of programming knowledge doesn't help. :confused:

Code:
simconnect.AddToDataDefinition(DEFINITIONS.Struct1, "Payload Station Name:1", null, SIMCONNECT_DATATYPE.STRING256, 0.0f, SimConnect.SIMCONNECT_UNUSED);

void simconnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
{
      switch ((DATA_REQUESTS)data.dwRequestID)
      {
         case DATA_REQUESTS.REQUEST_1:
              Struct1 s1 = (Struct1)data.dwData[0];

              //  displayText("Title: " + s1.title);
              displayText("Name: " + s1.payloadstationname1);
              displayText("Lat:   " + s1.latitude);
              displayText("Lon:   " + s1.longitude);
              displayText("Alt:   " + s1.altitude);
              break;

In the image below, see #3 in the Responses text box .

sta_name.JPG


I hope that with all your experience that you will know out how to make it work like you want.
 

DragonflightDesign

Resource contributor
Messages
1,096
Country
northernireland
It's a serious PITA because you have to resort to System.Reflection to query the value of each station name, particularly when you assume you don't know how many stations there are going to be. I did eventually get all of them (and their associated weights) but it took nearly three hours of trying because I'd never used System.Reflection before. Annoyingly, it turned out to be really easy once I'd fought my way through documentation, trial and error.

It's not something I'm keeping to myself either. I've greatly expanded (and improved!) the original VB Managed Data Request and intend to publish it once I've written something to accompany it. It'll probably go in the next issue of sd2gau.
 
Top