It looks like either removing a CallLater, or GetRemainingTime does not work properly.
In the following example i'm using:
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ReplenishHoneyFrame1, GetFillFrameTime(), false, frame1, slot_id);
to start the Timer when a frame got attached.
Now, when the frame got detached, I'm using:
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ReplenishHoneyFrame1);
But if i will check the remaining Time now using:
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).GetRemainingTime(ReplenishHoneyFrame1)
It will still return the remaining time.
If i attach the frame now again, and check the remaining time, it will be less time than the last check.
Therefore you would assume that the Timer is still running, but the function which gets called from the CallLater will never be executed.
This would mean that removing the CallLater does indeed work, but how can GetRemainingTime still return the time?
In the following example, i made some Prints which maybe explains it a bit better. I'm using EEItemAttached and EEItemDetached to either start a CallLater or Remove a CallLater:
First time attach: SCRIPT : ----------frame1 added Start---------- SCRIPT : Frame attached= rag_honeycomb_frame_empty<a119a220> SCRIPT : Frame active= false SCRIPT : Checking Remaining Time after Frame got attached using GetRemainingTime... Should return -1 since not started yet. SCRIPT : GetRemainingTime ReplenishHoneyFrame1= -1 SCRIPT : Starting CallLater now... SCRIPT : CallLater started. Checking Remaining Time now using GetRemainingTime... SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3600000 SCRIPT : Frame active= true SCRIPT : ----------frame1 added End---------- First time detach: SCRIPT : ----------frame1 removed Start---------- SCRIPT : Frame attached= NULL SCRIPT : Frame active= true SCRIPT : Checking Remaining Time of CallLater using GetRemainingTime BEFORE using Remove... SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3592411 SCRIPT : CallLater is now removed, will now make sure and check again using GetRemainingTime... should return -1 SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3592411 SCRIPT : Frame active= false SCRIPT : ----------frame1 removed End---------- Second time attach: SCRIPT : ----------frame1 added Start---------- SCRIPT : Frame attached= rag_honeycomb_frame_empty<a119a220> SCRIPT : Frame active= false SCRIPT : Checking Remaining Time after Frame got attached using GetRemainingTime... Should return -1 since not started yet. SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3587235 SCRIPT : Starting CallLater now... SCRIPT : CallLater started. Checking Remaining Time now using GetRemainingTime... SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3587235 SCRIPT : Frame active= true SCRIPT : ----------frame1 added End---------- Second time detach: SCRIPT : ----------frame1 removed Start---------- SCRIPT : Frame attached= NULL SCRIPT : Frame active= true SCRIPT : Checking Remaining Time of CallLater using GetRemainingTime BEFORE using Remove... SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3580948 SCRIPT : CallLater is now removed, will now make sure and check again using GetRemainingTime... should return -1 SCRIPT : GetRemainingTime ReplenishHoneyFrame1= 3580948 SCRIPT : Frame active= false SCRIPT : ----------frame1 removed End----------
As you can see, the first time i attached the frame, it will return -1 as there is no CallLater yet.
After the first time i detached the frame, it returns the remaining time even after the removal of the CallLater.
After the second time i attached the frame, it returns a smaller time then it did after it got detached, which indicates that the CallLater is still running.
After the second time i detached it, the same as the first time, still returning time after removing CallLater.
In tools.c Class ScriptCallQueue it is commented:
//! remove specific call from queue proto void Remove(func fn);
But it seems it does only remove the function, not the actual Call.