Originally Posted by SDPhantom
Here's what I would do.
Lua Code:
local LevelTimes={};-- For this example, we'll say this is loaded from SavedVar local EventFrame=CreateFrame("Frame"); EventFrame:RegisterEvent("PLAYER_LEVEL_UP"); EventFrame:RegisterEvent("TIME_PLAYED_MSG"); EventFrame:SetScript("OnEvent",function(self,event,...) if event=="PLAYER_LEVEL_UP" then self.WaitingForPlayTime=true;-- Flag continuation RequestTimePlayed(); elseif event=="TIME_PLAYED_MSG" and self.WaitingForPlayTime then self.WaitingForPlayTime=false;-- Clear flag LevelTimes[UnitLevel("player")-1]=...;-- Record time to complete level end end);
|
While not directly my solution SDPhantom, you completely made me realize I was going about the execution of everything in the wrong order.
I was sticking almost ALL my main work in PLAYER_LEVEL_UP, when it should have been in TIME_PLAYED_MSG that was my natural delay I needed
Thank you so much for your input, I'm about 4 days into learning LUA in any capacity lol so there's definitely some tricks to learn
All is working as intended now.