Hooks Not Working
I'm attempting to make a custom UI for the achievement panel and the first change I want to make is modifying the summary progress bars. On ESOUI's repo, I found that line 1546 in this file is what initializes the summary. Shortly after that is what updates it. I want to hook into these two functions, and I'm attempting to do that via:
Lua Code:
|
The hook should work as the ACHIEVEMENTS global exists, is the correct object of the Achievment class.
I've read the code this way: https://github.com/esoui/esoui/blob/...ents.lua#L1893 Called by the XML's OnInitialized event -> ZO_Achievements_OnInitialize(self) -> ACHIEVEMENTS = Achievements:New(self) -> https://github.com/esoui/esoui/blob/...ments.lua#L949 -> object:Initialize(...) -> https://github.com/esoui/esoui/blob/...ments.lua#L963 -> function Achievements:Initialize(control) -> self:InitializeSummary() -> function Achievements:InitializeSummary() Maybe it was done before the chat output is ready so you are not seeing it (will first be visible at event_player_activated!). -> Install the addon pChat which should fix this. -> OR/AND use the LibDebugLogger and the DebugLogViewer UI to see the addon debug messages prior the chat output is ready + stored in your SavedVariables. Edit1: I've added your code to any of my addons event_player_activated callback function and I also do not see it. Edit2: I think it is because the Achievements "class" is defined local: --[[ Achievements ]]-- local Achievements = ZO_Object:Subclass() And it's not a ZO_Achievements global variable. I guess this is intended so noone can manipulate the summaries etc. The only globals are the ones at the bottom of the file below --[[ XML Handlers ]]-- |
Quote:
Stacktrace: Lua Code:
|
Interestingly commenting out the print and un-commenting return true in the hook yields the same error. The UI of the summary also remained intact, assuming the proper behavior was to not generate it since the hook cancelled the default function from running.
|
Current session in LDL only says from start of the game client to end of the game client.
Current UI reload only shows what was added since you did a reloadui -> Should be enough for testing imo. "Avoiding cycle on table" is a debug output of the d() function in eso source code. function d(...) for i = 1, select("#", ...) do local value = select(i, ...) if(type(value) == "table") then EmitTable(value) else EmitMessage(tostring (value)) end end end Within EmitTable then: if(tableHistory[v]) then EmitMessage(indent.."Avoiding cycle on table...") It shows you that the d() output somehow triggered a table and no String to show in chat. > Your line 12 in file QuantumsGlobalAchievements.lua So one of your parameters in your d calls seems to be a table, or at least gets recognized as a table. |
InitializeSummary is called in Initialize, which is called from XML.
This built-in code runs before any addon code. Your hook is and will be too late. UpdateSummary is called, if the category is re-selected. So, you have to click to another category and go back. |
All times are GMT -6. The time now is 11:34 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI