atmo 29 Posted January 7, 2019 I probably being stupid again, and I suspect I have missed it already in the forums.. How do I test an object for the presence of an event handler? There seem to plenty of commands to add and remove them... I noticed @Larrow used !( isNil { _x getVariable "HitEH" } ) in a post recently.... Is that the same for all EHs? So reloaded would be "ReloadedEH"? I ask because I am transferring objects from servers to clients/HCs and I am not sure if they transfer with some or all of their respective EHs etc.... I am trying to test this but I would like to ask the community for a comprehensive answer before trying to test every single one.... Atmo Share this post Link to post Share on other sites
Larrow 2675 Posted January 7, 2019 33 minutes ago, atmo said: I noticed @Larrow used !( isNil { _x getVariable "HitEH" } ) in a post recently.... Is that the same for all EHs? If you read that code again you will see that I save the event ID on the target when I add the event. _target setVariable[ "HitEH", _target addEventHandler[ "Hit", { /*BLAH*/ } ] ]; Other than storing the ID there is no way to get a list of ID's for currently active events. 1 1 Share this post Link to post Share on other sites
Schatten 252 Posted January 7, 2019 @atmo, use this function to check for presence of event handler of given type: params [ ["_object", objNull, [objNull]], ["_type", "", [""]] ]; if ((isNull _object) or {_type == ""}) exitWith {false}; private _index = _object addEventHandler [_type, ""]; _object removeEventHandler [_type, _index]; _index > 0 4 Share this post Link to post Share on other sites
atmo 29 Posted January 7, 2019 Ah. Nice one. Thanks. Atmo Share this post Link to post Share on other sites