Firing custom events for gauges

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
mcoligny
Posts: 35
Joined: Wed Mar 12, 2014 9:16 pm

Post by mcoligny »

Greetings,



I am trying to notify a gauge of custom events. My first attempt was to do this in a normal exe plugin. I add the events like so when first connected to P3d:



Code:
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, MY_EVENT_1, "My.event_1");
hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, MY_EVENTS, MY_EVENT_1, false);



Then I create a key-map trigger in the gauge like so:



Code:
<KeyMap id="trigger_map">
<Trigger id="Start">
<KeyEvent>My.event_1</KeyEvent>
<Script>Do some schtuff</Script>
</Trigger>
</KeyMap>



It works all right except for 1 catch. When the exe is added to exe.xml the first trigger element throws an error saying that the event is not recognized. I take it to mean that the xml is parsed before the plugin is launched. Is there any way to remove this inconvenience so that I can use custom events this way? I tried sleeping in a lua script as a part of the element that is directly before the events, but that didn't work. Do I have to port this functionality to a mixed DLL/XML gauge. I would prefer not to, because a lot of the gauge is already written in XML.



Thanks in advance,

Ian
Locked