Expire() and Cancel() on the other hand should allow the developer to potentially prevent removal prior to Remove() being called by setting active back to 1 during Expired() or Canceled().
All code currently in Added() should be migrated to the tail end of Add().
Ticker() and Timer() should also be called from Add() and not Added().
This is the recommended new code for Add():
Add()
//[snip old code]
active = 1
start_time = time
Added(target,time) //call the Added() hook.
if(active)
if(duration<1#INF) //if the effect has a duration
if(tick_delay) //and the effect has a tick delay, initiate the ticker.
Ticker(target,time)
else //otherwise, initiate the timer
Timer(target,time)
else if(tick_delay)
Ticker(target,time)
else
Remove()
return 0
return 1 //return success
As you can see, active can be set to 0 within the Added() hook, effectively canceling any tickers or timers. It will immediately force the removal of the effect if active does not stay true after addition to the effects registry.
Remove() should force active to be zero even if Removed() changes the value, as it is already removed from the effects registry and list by the time Removed() has been called. There's no going back at that point.