What would happen when a TOGGLE_AIRCRAFT_EXIT is performed in the air, of course, door will not open. But when you land & get under 70kts guess what? The door will automatically open unless some other background checks are made. Such as a combo of my original XML gauge & the modeldef mods too.
Exactly right …...
The event TOGGLE_AIRCRAFT_EXIT probably is the weardest and most complex event implementation in the history of FS*, which all its variants in usage now and it's built-in delay-of-execution.
Like:
- " (>K:TOGGLE_AIRCRAFT_EXIT) "; toggles only the first exit (EXIT:0), after a 0.7 sec. or so delay.
- " (>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_0) " ; has the same result, same delay.
- " (>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_1) "; toggle the second exit (EXIT:1), same delay.
- " (>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_0) (>K:SELECT_1) "; toggles first and the second exit, but still the same delay.
- " 1 (>K:TOGGLE_AIRCRAFT_EXIT) "; toggles the first exit (EXIT:0), NO delayed execution.
- " 2 (>K:TOGGLE_AIRCRAFT_EXIT) "; toggles the second exit (EXIT:1), NO delayed execution.
etc etc. for the other Exits.
Also, just forcing the Exit state A:EXIT OPEN:0 via SimConnect to 0 (eg. from XML, using SIMVARS in XMLTools) doesn't work either: the moment you stop overwriting A:EXIT OPEN:0, the Avar will be increasing/decreasing to fully open/closed again, depending on the last detected ToggleExit event for that Exit. Apperantly FS maintains internal states for this, for each Exit.
Meaning that, like with the animation code solution, you still need additional code issuing ToggleExit events to force this internal state to the desired position (open/closed).
Hence the charm of your code in post#2: extremely simple, if one accepts the (almost invisible, depending on the specified ExitRate in the aircraft.cfg) short opening/closing of the door after a user ToggleExit command.
With the added advantage that it works independantly for all Exits; I personally wouldn't even start thinking about the complexity to maintain this independancy, by using an event-capturing method, to make it fool-proof.
Given all variations of possible event sequences for this ToggleAircraftExit event.
Cheers,
Rob