First install & not printing to screen/showing frame
I was debugging TSM_StringConverter and found an oddity. If the saved variables are wiped, or the addon is freshly installed, the GUI and chat messages are not displayed. If I /reload my UI and don't change any of settings, the slash commands work.
Further, the slash commands do not work at all during a fresh installation. It is like they aren't being initialized when they are called. The test prints in PEW are not doing anything during the first install either. They work after a /reload. And I don't know why I am getting this behaviour. Code:
local title, addon = ... |
I might be missing something obvious but .. is there a chance that PLAYER_ENTERING_WORLD is triggering before PLAYER_LOGIN meaning that the .login and .reload flags don't get set until the reload, or if PLAYER_LOGIN is triggered first.
Outside of that old chestnut which may or may not have been fixed since I noticed that problem several years back I can't see anything else myself. |
What is TSM_StringConverter and is it LOD?
If it is, maybe it is loaded by the "host" addon at PLAYER_LOGIN meaning that event will have already passed before TSM_StringConverter is loaded... or some shenanigans like that. |
Quote:
Quote:
|
On the face of it it looks like it should work but what's here obviously isn't the entire addon.
If you cut the addon down (create a test addon) to just this code and it works then the problem is elsewhere. Things like adding events (event functions) to the addon table is possibly prone to having them overwritten somewhere else (another .lua module). |
1 Attachment(s)
Here is the full addon, retail WoW version.
|
First install seemed to work. GUI popped up, PrintCommands() ran, slash command worked, events were processed and in expected order.
Worked just the same after exiting and deleting the SV file. And again after logging on to a different character... |
I was about to test again, after wiping my saved variables. If you saw it working, that's a good sign. Apparently ADDON_LOADED does fire before PEW, but PLAYER_LOGIN may not. I went with the Wowpedia.org event loading process, albeit before I posted my question, I was not handling the event args correctly.
For some reason, I had this in my head, which clearly is not correct: Code:
function MyAddOn:EventHandler(event, ...) |
If PLAYER_LOGIN didn't fire until after PEW then all my addons would be broken. It should fire only once after all inital ADDON_LOADEDs have happened and before PEW.
Which might have caused a propblem if at some stage you registered ADDON_LOADED and PLAYER_LOGIN but unregistered PLAYER_LOGIN at ADDON_LOADED. What you get in your event functions is entirely dependant on what your OnEvent script sends them. You may have seen code from someone that sends the event and payload (I tend to send the frame "self" to the functions, but that's me). Edit: For giggles, I changed the code from ADDON_LOADED to PLAYER_LOGIN, reset and everything worked fine as well. |
Oops .. it wasn't the loading order of PLAYER_LOGIN and PLAYER_ENTERING_WORLD I was remembering but VARIABLES_LOADED. We used to use the last one in nUI and had intermittent issues so switched to PLAYER_ENTERING_WORLD or PLAYER_LOGIN as needed to fix those issues.
Had to search the nUI archives to refresh my memory on what I was recalling from 10+ years ago :chuckle: |
All times are GMT -6. The time now is 12:28 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI