Page MenuHomeFeedback Tracker

[Feature Request] Diag command for returning the last id of event handler of a certain type
Closed, ResolvedPublic

Description

Diag commands that return the last event handler id of a certain type can be useful.

One instance is the case where you want to make sure that your event handler is the last event handler. For example, in the case of a "HandleDamage" EH only the last event handler works.

unit addEventHandler ["HandleDamage", {
params ["_unit"];
if (diag_eventHandlerCount [_unit, "HandleDamage"] > _thisEventHandler) {
_unit removeEventHandler ["HandleDamage", _thisEventHandler];
// readd
}
0
}]

sample syntax:
diag_eventHandlerCount [_unit, "HandleDamage"]

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
Scripting

Event Timeline

Leopard20 updated the task description. (Show Details)
h- added a subscriber: h-.May 2 2021, 5:50 PM

Wouldn't mind if also a command to return all ehs handlers of any type would be added, similar to what diag_allMissionEventhandlers does but for the rest of the types, and return would be in format of something like:
["eh type", [handler ids], "eh type 2", [handler ids].. ]

So one could keep track of accidentally multiplying ehs for example 🤔