One of the biggest concerns for me and many other scripters when writing event-handler-oriented codes is that if someone removes our EHs by mistake (e.g. using incorrect ID, like how many newbies just remove `0`) or intentionally (many newbies doing `removeAllXXXEventHandlers`), our design could fail entirely.
Thus, I would like to ask for scripting commands that allow us to detect and counter these problems.
1. Get next event handler ID:
getEventHandlersCount [entity, "name"];
entity: can be NAMESPACE (only missionNamespace maybe? for mission/user EHs)/OBJECT/GROUP/CONTROL/DISPLAY
name: event handler name
returns: number of EHs added (in other words, last added ID)
Since EH IDs are incremental, this allows us to know if any new EHs have been added after ours. This command will also be useful for the Intercept project.
2. An EH that checks if the event handler still exists and has not been removed yet:
isEventHandlerValid [entity, "name", ID]
ID: number: EH ID