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 (maybe only missionNamespace? for mission/user EHs)/OBJECT/GROUP/CONTROL/DISPLAY
> name: event handler name
> returns: total number of EHs added (which is also the same as next added ID)
Alternatively, for mission/user EHs the syntax can be:
> `getEventHandlersCount "name"`
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. A command that checks if the event handler still exists and has not been removed yet:
> `isEventHandlerValid [entity, "name", ID]`
> entity: can be NAMESPACE (maybe only missionNamespace? for mission/user EHs)/OBJECT/GROUP/CONTROL/DISPLAY
> name: event handler name
> ID: number: EH ID
> returns: bool
Alternatively, for mission/user EHs the syntax can be:
> `getEventHandlersCount ["name", ID]`
or
> `"name" getEventHandlersCount ID`