When you use the OnCrash, OnStall, and OnKey commands (event-driven commands), you must set up a pointer to a special subroutine that will be called later, when the specified event is triggered. The special subroutine can be activated any time Flight Simulator is running and the event is triggered. However, only one special subroutine may be active at a time. For example, if the user's plane stalls while an OnKey routine is executing, the OnStall routine is not called. (If the plane is still stalled when the OnKey routine is completed, the OnStall routine is called.) When the special subroutine is called, its return address is pushed on the stack just as if a GoSub command had been executed, and the special subroutine is interpreted until that return address is popped from the stack by a Return command. If the special subroutine calls subroutines, those subroutines are considered part of the special subroutine. The APL interpreter does not return control to Flight Simulator until the special subroutine interpretation is complete.
If the special subroutine is called:
Because special subroutines are interpreted without returning control to Flight Simulator, the interpreter terminates an adventure if more than 10,000 commands are interpreted after the interpreter is initially invoked by Flight Simulator.