Page MenuHomeFeedback Tracker

Removing a CallLater does work and somehow not?
Closed, ResolvedPublic

Description

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.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

Execute a CallLater
Remove the CallLater
Check remaining Time using GetRemainingTime

Event Timeline

Tyson created this task.Jul 11 2023, 9:56 AM
Tyson updated the task description. (Show Details)
Tyson updated the task description. (Show Details)
Tyson updated the task description. (Show Details)Jul 11 2023, 10:00 AM
ntepup added a subscriber: ntepup.Jul 11 2023, 1:08 PM
Geez changed the task status from New to Confirmed Internally.Jul 11 2023, 1:50 PM
Geez added a subscriber: Geez.Jul 11 2023, 2:00 PM

Hello Tyson.
The issue lies with GetRemainingTime and we are looking into fixing it.

Tyson added a comment.Jul 11 2023, 2:42 PM

Nice, that's good news. Thanks

Geez closed this task as Resolved.Aug 1 2023, 11:45 AM
Geez claimed this task.

Resolved for the future 1.22 updates.