Thaoky / Altoholic_Retail

WoW Altoholic Addon (WoW Retail version)
24 stars 5 forks source link

Addon breaks when enabled on a character that's already logged in #39

Closed nwferreri closed 1 month ago

nwferreri commented 2 months ago

This problem is a bit complicated, but it's consistent from all the various ways that I've tested it. If I log in to a character that doesn't have Altoholic enabled and then enable it with a UI reload, it breaks the addon.

Here's a screenshot of what the panel looks like when this happens.

Screen Shot 2024-08-14 at 8 33 47 PM

Here's the error that pops up with no other addons enabled (except Addon Control Panel):

Message: ...AddOns/DataStore_Characters/DataStore_Characters.lua:215: bad argument #3 to 'format' (string expected, got nil)
Time: Wed Aug 14 20:38:29 2024
Count: 1
Stack: ...AddOns/DataStore_Characters/DataStore_Characters.lua:215: bad argument #3 to 'format' (string expected, got nil)
[string "@Interface/AddOns/DataStore_Characters/DataStore_Characters.lua"]:215: in function <...AddOns/DataStore_Characters/DataStore_Characters.lua:214>
[string "=(tail call)"]: ?
[string "@Interface/AddOns/Altoholic_Summary/Columns_CharacterInformation.lua"]:290: in function `GetText'
[string "@Interface/AddOns/Altoholic_Summary/Templates/SummaryPaneButton.lua"]:11: in function `SetColumnData'
[string "@Interface/AddOns/Altoholic_Summary/Templates/SummaryPaneRow.lua"]:112: in function `DrawCharacterLine'
[string "@Interface/AddOns/Altoholic_Summary/TabSummary.lua"]:730: in function `Update'
[string "@Interface/AddOns/Altoholic_Summary/TabSummary.lua"]:789: in function `callback'
[string "@Interface/AddOns/AddonFactory/Templates/AuctionHouseUI/CategoriesList.lua"]:58: in function `Button_OnClick'
[string "@Interface/AddOns/Altoholic_Summary/TabSummary.lua"]:939: in function `callback'
[string "@Interface/AddOns/DataStore/Events/Loading.lua"]:25: in function <Interface/AddOns/DataStore/Events/Loading.lua:18>
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "*Main.xml:65_OnShow"]:2: in function <[string "*Main.xml:65_OnShow"]:1>
[string "=[C]"]: in function `Show'
[string "@Interface/AddOns/Altoholic/Core.lua"]:165: in function `?'
[string "@Interface/AddOns/Altoholic/Core.lua"]:188: in function `?'
[string "@Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:5468: in function `ChatEdit_ParseText'
[string "@Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:5120: in function `ChatEdit_SendText'
[string "@Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:5156: in function `ChatEdit_OnEnterPressed'
[string "*ChatFrame.xml:140_OnEnterPressed"]:1: in function <[string "*ChatFrame.xml:140_OnEnterPressed"]:1>

Locals: character = <table> {
 BaseInfo = 547142
 playedThisLevel = 71000
 played = 3184501
}

Sometimes, the list of strings in the error change if the error happens multiple times in a session or if other addons are enabled, but the error always starts with DataStore_Characters/DataStore_Characters.lua:215: bad argument #3 to 'format' (string expected, got nil).

If I then log out and log back in on that same character, Altoholic works correctly. I've also determined that if I enable Altoholic from the Addon menu on the character selection screen, and then log in to a character, it avoids this problem. So it seems like there's a problem when the addon isn't already enabled when you log in.

swotam commented 2 months ago

I'm not a developer but I've encountered this myself, and I believe it's because there's no data available for the character when you enable it in this way, so it throws an error. Most WoW addons write info to their config or data files either when you login or when you logout, but a reload from the Addon window just reloads the UI and any enabled addons. It doesn't do what's needed to create the datastore entry for the user in question. Since Altoholic requires basic character info to be present in the Datastore when opening the window, you get an error when this data isn't present.

As you've noted, the solution is to logout and then login, or enable the addon from the character selection screen. Not sure if this is something the dev can fix, since it's more to do with behaviour related to doing a reload as opposed to login/logout.

nwferreri commented 2 months ago

I definitely understand that, but I swear I used to be able to load Altoholic after already logging in.

Thaoky commented 1 month ago

Won't fix. The add-on, being a more complex structure than other add-ons, relies on events triggered at logon. Failing to do so causes such errors. It is highly recommended to keep it active all the time (all Altoholic_xx use no memory, they are Load-on-demand).

nwferreri commented 1 month ago

I totally get that. Maybe you could add a message that this is how the addon works to the addon's curse page to let people know. I wonder too if there's a way to display a message in game instead of throwing a bug. Would be less confusing for people.