Thread Tools Display Modes
09/11/21, 07:48 PM   #1
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
[open] Addon registered events not firing on AVA state change

It seems like the game has an internal delay built into the API that blocks sending callbacks to addons registered for certain/all (?) events upon joining a campaign, and possibly after the campaign status changes.

I tested this by manually firing the event Srendarr registers to refresh auras on zone changes on a timer that runs every 1 second after joining a campaign by registering the event EVENT_CAMPAIGN_STATE_INITIALIZED. The first time the loop fires the aura update function doesn't run. However on the 3rd or 4th iteration (a few seconds after joining) the loop finally registers and the auras populate.

This is probably due to some internal checks the game is doing which block addon-registered event callbacks until it is complete, however there should really be a way to query whether this is done or better yet, an event you could register for that would alert addons when they are ready to process, as looping on campaign changes for a set number of seconds is both clunky and not guaranteed to always give enough time for the internal game checks to complete, unless you set the loop to run for a long time like 10 seconds.

Is there currently any way to register for this internal delay to inform addons they are clear to proceed after joining/updating an AVA campaign?

Here is an example:

Code:
local checkingAVA = false
local campaignLoop = 0

local function OutputTest(timer)
	d("Function ran at: "..tostring(timer).." seconds.")
end

local function CampaignStateLoop(update)
	if (not checkingAVA) or (update) then
		checkingAVA = true
		if campaignLoop <= 5 then -- can increase to loop for longer than 5sec (may be needed based on processor speed?)
			campaignLoop = campaignLoop + 1
			OutputTest(campaignLoop)
			zo_callLater(function() CampaignStateLoop(e, true) end, 1000 + GetLatency())
		else
			campaignLoop = 0
			checkingAVA = false
		end
	end
end
EVENT_MANAGER:RegisterForEvent("Srendarr", EVENT_CAMPAIGN_STATE_INITIALIZED, function() CampaignStateLoop() end)
EVENT_MANAGER:RegisterForEvent("Srendarr", EVENT_CURRENT_CAMPAIGN_CHANGED, function() CampaignStateLoop() end)

Last edited by Phinix : 09/11/21 at 08:02 PM.
  Reply With Quote

ESOUI » Developer Discussions » Bug Reports » [open] Addon registered events not firing on AVA state change

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off