Simconnect CRASH FLAG

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
zhaohy0623
Posts: 4
Joined: Mon Jan 21, 2019 2:19 am

Simconnect CRASH FLAG

Post by zhaohy0623 »

I want to read the CRASH FLAG in P3D via simconnect. I use AddToDataDefinition() function to read it and I've tried different ways but all failed. Is there anyone know what's wrong with this problem and help me to solve it, I'll be appreciate for your help.
User avatar
Simbol
Posts: 908
Joined: Thu Sep 07, 2017 10:24 pm
Location: UK
Contact:

Re: Simconnect CRASH FLAG

Post by Simbol »

zhaohy0623 wrote: Mon Jan 21, 2019 2:37 am I want to read the CRASH FLAG in P3D via simconnect. I use AddToDataDefinition() function to read it and I've tried different ways but all failed. Is there anyone know what's wrong with this problem and help me to solve it, I'll be appreciate for your help.
What crash are you trying to detect? the user crashing? or something else?

Regards,
Simbol
Image
CEO Flight Sim Technologies Ltd
Oficial Website: https://www.FSReborn.com
zhaohy0623
Posts: 4
Joined: Mon Jan 21, 2019 2:19 am

Re: Simconnect CRASH FLAG

Post by zhaohy0623 »

Simbol wrote: Mon Jan 21, 2019 9:40 am
zhaohy0623 wrote: Mon Jan 21, 2019 2:37 am I want to read the CRASH FLAG in P3D via simconnect. I use AddToDataDefinition() function to read it and I've tried different ways but all failed. Is there anyone know what's wrong with this problem and help me to solve it, I'll be appreciate for your help.
What crash are you trying to detect? the user crashing? or something else?

Regards,
Simbol
Hi Simbol, I'm trying to recognize the crash of aircraft when it's collising with terrain or buildings.

Regards
Deman Zhao
User avatar
Simbol
Posts: 908
Joined: Thu Sep 07, 2017 10:24 pm
Location: UK
Contact:

Re: Simconnect CRASH FLAG

Post by Simbol »

You can subscribe to the detection of the crash via SimConnect_SubscribeToSystemEvent.

It is fairly simple to do, you map an event id to the crash event, you use the function above to register for notifications and then you listen to such event id to know when it happened.

Information: http://www.prepar3d.com/SDKv4/sdk/simco ... ystemEvent

An example of monitoring of events: http://www.prepar3d.com/SDKv4/sdk/simco ... nitor.html

Regards,
Simbol
Image
CEO Flight Sim Technologies Ltd
Oficial Website: https://www.FSReborn.com
zhaohy0623
Posts: 4
Joined: Mon Jan 21, 2019 2:19 am

Re: Simconnect CRASH FLAG

Post by zhaohy0623 »

Simbol wrote: Wed Jan 23, 2019 3:40 pm You can subscribe to the detection of the crash via SimConnect_SubscribeToSystemEvent.

It is fairly simple to do, you map an event id to the crash event, you use the function above to register for notifications and then you listen to such event id to know when it happened.

Information: http://www.prepar3d.com/SDKv4/sdk/simco ... ystemEvent

An example of monitoring of events: http://www.prepar3d.com/SDKv4/sdk/simco ... nitor.html

Regards,
Simbol
Thanks Simbol, I've tried this sample and it works well. Now I want to recognize the flag of crash using this sample : https://www.prepar3d.com/SDKv4/sdk/simc ... _data.html
but when I just add a property named Crash_Flag and use SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Crash Flag", "enum") to register property, it doesn't work at all. Do you know what's wrong with it?

Regards
Deman Zhao
User avatar
Simbol
Posts: 908
Joined: Thu Sep 07, 2017 10:24 pm
Location: UK
Contact:

Re: Simconnect CRASH FLAG

Post by Simbol »

You need to use the system event notification, no requesting the data via data requests, the SimConnect_SubscribeToSystemEvent function is used to request that a specific system event is notified to the client.

Check the examples I gave you before, particularly the "pause monitor", following the same approach you need to register for the event notification "Crashed".

Regards,
S.
Image
CEO Flight Sim Technologies Ltd
Oficial Website: https://www.FSReborn.com
Post Reply