Minor Error while logging a new character.
Titan Panel is an AddOn for the MMORPG World of Warcraft
Brought to you by:
honorgog
Hello guys,
I'm receiving this first time message once I log in a new character.
Message: Interface/AddOns/TitanGold/TitanGold.lua:1129: attempt to index field '?' (a nil value)
Time: Sat Aug 17 22:58:15 2024
Count: 1
Stack: Interface/AddOns/TitanGold/TitanGold.lua:1129: attempt to index field '?' (a nil value)
[string "=[C]"]: ?
[string "@Interface/AddOns/TitanGold/TitanGold.lua"]:1129: in function <Interface/AddOns/TitanGold/TitanGold.lua:1127>
[string "@Interface/AddOns/TitanGold/TitanGold.lua"]:1247: in function <Interface/AddOns/TitanGold/TitanGold.lua:1246>
[string "=[C]"]: in function `Show'
[string "@Interface/AddOns/Titan/Titan.lua"]:1724: in function `TitanPanel_InitPanelButtons'
[string "@Interface/AddOns/Titan/TitanUtils.lua"]:1466: in function `TitanUtils_AddButtonOnBar'
[string "@Interface/AddOns/Titan/TitanVariables.lua"]:757: in function <Interface/AddOns/Titan/TitanVariables.lua:727>
[string "@Interface/AddOns/Titan/TitanVariables.lua"]:1235: in function <Interface/AddOns/Titan/TitanVariables.lua:1108>
[string "@Interface/AddOns/Titan/TitanVariables.lua"]:1446: in function `TitanVariables_UseSettings'
[string "@Interface/AddOns/Titan/Titan.lua"]:352: in function <Interface/AddOns/Titan/Titan.lua:233>
[string "=[C]"]: in function `pcall'
[string "@Interface/AddOns/Titan/Titan.lua"]:448: in function `?'
[string "@Interface/AddOns/Titan/Titan.lua"]:225: in function <Interface/AddOns/Titan/Titan.lua:224>
Locals:
1) Did this problem occur on the latest PTR build? -> TitanPanel-8.1.0 version / Game Version 11.0.2
2) Are you using the latest version of Titan Panel? -> Yes
3) On what operating system did this issue occur? -> Windows 11
4) What are the steps necessary to reproduce this problem? - Just log a new character.
5) Please attach a screenshot if you believe that will assist us. - Screenshot is basically the code listed.
As it seems happens only at first time, I tried deleting variables, folders, reinstalling and the problem persists always on the new characters.
Thanks!
This strongly implies events are not in the order I thought as WoW starts up :).
Thanks for reporting, I'll tighten the code to prevent this error.
Until you logout and in again I suspect two items will not be correct:
- Gold per hour
- Warband bank will show 0 (zero)
Otherwise Gold should work as expected.
Ref: https://warcraft.wiki.gg/wiki/AddOn_loading_process
The problem is that Initialize_Array() is doing two different tasks that belong at different times:
- Creating the table structure (and validating it hasn't been corrupted)
- Recording the session starting time and session starting gold.
Both tasks are needed after clearing the database, of course, but during the login process you need these activities at different times. The table structure should be ready to go with ADDON_LOADED, but GetMoney() isn't guaranteed to provide the actual number until PLAYER_LOGIN because it could still be downloading from the server.
I am attaching a possible solution:
- Initialize_Array() is now part of ADDON_LOADED, immediately after defining GOLD_INDEX, but some instructions have been placed elsewhere.
- Initialize_Session() is a new function, called during PLAYER_LOGIN, that handles tasks which need to be deferred.
- The code is simplified a bit using PLAYER_LOGIN instead of PLAYER_ENTERING_WORLD.
Edit: I removed and re-uploaded the file after taking out a line of code that wasn't necessary.
Last edit: Dahk Celes 2024-09-01
Dahk-
Thank you for the possible solution!
I won't be able to make changes until Oct.
I'll bring this to Honor's attention although I know he is pretty swamped at work.
Just letting you know, we may not be able to add & test for a bit.
Thanks again!