April 16, 20197 yr Hello everyone,I want to read the list of waypoints that an AI aircraft is currently following. The "AI WAYPOINT LIST" seems to be what I want but I don't understand how to extract information from it using managed C#.I have a definition with a bunch of other variable that work, only this is giving me trouble. Some of the code im using to request the data:simConnect.AddToDataDefinition(DEFINITIONS.DATA_DEFINITION, "AI WAYPOINT LIST", "", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);simConnect.RegisterDataDefineStruct<Data_Definition>(DEFINITIONS.DATA_DEFINITION);[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]public struct Data_Definition{<other data variables>public SIMCONNECT_DATA_WAYPOINT waypoint;};Thank you in advance,Daniel
April 16, 20197 yr Commercial Member Hi, You don't need a data structure for this, but a callback instead Create a definition enum value and a data request enum only for the waypoint list Create the callback method to receive the waypoint list data (simconnect.OnRecvWaypointList += new SimConnect.RecvWaypointListEventHandler(simconnect_OnRecvWaypointList);) drop in the AddToDataDefinition - a single one for the waypoint list (simconnect.AddToDataDefinition(DEFINITIONS.AIWAYPOINTS, "AI WAYPOINT LIST", "number", SIMCONNECT_DATATYPE.WAYPOINT, 0.0f, SimConnect.SIMCONNECT_UNUSED);) Now just request the data (simconnect.RequestDataOnSimObject(DATA_REQUESTS.AI_WAYPOINTS, DEFINITIONS.AIWAYPOINTS, ObjectID, SIMCONNECT_PERIOD.ONCE, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, 0, 0, 0);) The result will be transmitted to you in repeated callbacks to your simconnect_OnRecvWaypointList method. This principle is applicable to all data requests that result in something "special", most importantly lists of any kind. First thing to do is check for an OnRecv… callback pertaining to your data request. (not sure where I got the "number" part as DatumName from. It works for setting the waypoint list, but you may want to change it to an empty string or null). Best regards Edited April 16, 20197 yr by Lorby_SI LORBY-SI
Archived
This topic is now archived and is closed to further replies.