Simconnect CRASH FLAG

zhaohy0623
Posts: 4
Joined: Mon Jan 21, 2019 2:19 am

Simconnect CRASH FLAG

Postby zhaohy0623 » 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.

User avatar
Simbol
Posts: 630
Joined: Thu Sep 07, 2017 10:24 pm
Location: UK
Contact:

Re: Simconnect CRASH FLAG

Postby Simbol » Mon Jan 21, 2019 9:40 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

Postby zhaohy0623 » Tue Jan 22, 2019 1:13 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: 630
Joined: Thu Sep 07, 2017 10:24 pm
Location: UK
Contact:

Re: Simconnect CRASH FLAG

Postby Simbol » 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
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

Postby zhaohy0623 » Thu Jan 24, 2019 3:08 am

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: 630
Joined: Thu Sep 07, 2017 10:24 pm
Location: UK
Contact:

Re: Simconnect CRASH FLAG

Postby Simbol » Thu Jan 24, 2019 8:46 am

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


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 10 guests