Donnovan Posted August 7, 2014 Report Share Posted August 7, 2014 Hi!When i run a event handler like that: myEH_hd = player addEventHandler ["handleDamage",{_this call run_stuff}];The number of the event handler is stored in myEH_hd.In my context, there is the possibilitie that another process use the code: player removeAllEventHandlers "handleDamage";And remove my event handler.So... there is any way to know if my event handler is still alive?---------//---------Also, this, about removeEventHandler, is true? When any handler is removed, all handler indices higher than the deleted one should be decremented.Sorry if i an asking too much. Thankyou! Link to comment Share on other sites More sharing options...
0 Sukkaed Posted August 7, 2014 Report Share Posted August 7, 2014 Remove it like this removeEventHandler ["handleDamage",myEH_hd]; Link to comment Share on other sites More sharing options...
0 Donnovan Posted August 7, 2014 Author Report Share Posted August 7, 2014 Thankyou Sukkaed,But the problem is to know if the event handler is alive. I don't know if it was removed, i need to check this.Something like that: while {state_on} do { waitUntil {Is the Event Handler Removed?}; //THIS! player addEventHandler ["handleDamage",{_this call run_stuff}]; };The "waitUntil {Is the Event Handler Removed?};" code is what i'm in search. Link to comment Share on other sites More sharing options...
0 Sukkaed Posted August 7, 2014 Report Share Posted August 7, 2014 Better to not use removealleventhandlers or reapply your own after that. As far as I know there is no way to check alive EH's. I would avoid loops everytime when possible. Link to comment Share on other sites More sharing options...
0 axeman Posted August 7, 2014 Report Share Posted August 7, 2014 Scriptdone is probably the closest you will get. https://community.bistudio.com/wiki/scriptDonet Link to comment Share on other sites More sharing options...
0 Donnovan Posted August 7, 2014 Author Report Share Posted August 7, 2014 Thankyou for the help. A player can have more than one handleDamage event handler? I believe the answer is yes, otherwise ther is no need for "add" and "all" in addEventHandler and removeAllEventHandlers... but... Link to comment Share on other sites More sharing options...
Question
Donnovan
Hi!
When i run a event handler like that:
In my context, there is the possibilitie that another process use the code:
So... there is any way to know if my event handler is still alive?
---------//---------
Also, this, about removeEventHandler, is true?
Sorry if i an asking too much. Thankyou!
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now