Jump to content
Sign in to follow this  
Emilio_G

triggering any of the failures via SimConnect

Recommended Posts

I am getting back into programming a managed application with SimConnect and while I have read the SDK documentation and gone through the examples I am totally lost at what they claim it is possible to do.

 

The Events section lists about 14 failures including engine failures (one for each possible engine), pitot blockage, pitot static, brake failures and system failures (vacuum, electrical, hydraulic).

 

But there is no single example on how to actually trigger any of these failures or query the simulator about the current state of the failures.

 

// subscribe to Engine Failures
simconnect.MapClientEventToSimEvent(EVENTS.FAIL_ENGINE_1, "TOGGLE_ENGINE1_FAILURE")      simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUP.BasicFailures, EVENTS.FAIL_ENGINE_1, false);

// set the group priority
simconnect.SetNotificationGroupPriority(NOTIFICATION_GROUP.BasicFailures, SimConnect.SIMCONNECT_GROUP_PRIORITY_HIGHEST);

 

and then I tried triggering with:

 

simconnect.TransmitClientEvent(00000001, EVENTS.FAIL_ENGINE_1, 1, NOTIFICATION_GROUP.BasicFailures, SIMCONNECT_EVENT_FLAG.DEFAULT);

 

and with

 

simconnect.SetSystemEventState(EVENTS.FAIL_ENGINE_1, SIMCONNECT_STATE.ON);

 

neither of them work.

Share this post


Link to post
Share on other sites

Emilio_G,

 

I'd suggest you to use the SetDataOnSimObject function to trigger a failure, like in the following example (it's Delphi but you'll easily grasp the idea):

 

first add it to data definition

SimConnect_AddToDataDefinition(hSimConnect, ord(DATDEF_SETENG1ONFIRE), 'ENG ON FIRE:1', '', SIMCONNECT_DATATYPE_INT32)

 

then call whenever you want it

SimConnect_SetDataOnSimObject(hSimConnect, ord(DATDEF_SETENG1ONFIRE), SIMCONNECT_OBJECT_ID_USER, 0, 0, 0, 0)

  • Upvote 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...