Stuck on TIME_PLAYED_MSG delay - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-14-20, 02:40 PM   #1
A Murloc Raider
Join Date: Oct 2020
Posts: 4
Stuck on TIME_PLAYED_MSG delay

Hi peeps,

I have the following in an addon I'm creating:

--Register /played event to unique frame
frame:SetScript("OnEvent", function(self, event, ...)
if (event == "TIME_PLAYED_MSG") then
TotalPlayed, PlayedThisLevel = ...
print("TotalPlayed, PlayedThisLevel "..TotalPlayed, PlayedThisLevel)

-- Register Level up hook to unique frame
lvlup = CreateFrame("Frame", UIParent)
lvlup:SetScript("OnEvent", function(self, event, ...)
if(event == "PLAYER_LEVEL_UP") then
print("Level up hook started")
newlevel = ...
print("NewLevel is: "..newlevel)
inum = (#KLTcharstats+1)
print("inum and inslvl = "..inum)
if (inum == 1 and KLTcharstats[inum].clevel == 1) then
print("Running if, that is inum = 1 and clevel = 1 --- TotalPlayed = "..TotalPlayed)
KLTcharstats[inum].TTP = TotalPlayed
KLTcharstats[inum].TFL = TotalPlayed

After all this has run there are the correct results in my default chat for time played and level time played, from the event handler BUT i only ever get 1 in the if at the end. Do i have table init that runs before all this so no issues with the creation of the table or variables.

I've been banging my head against this for hours, what do I have wrong? Or is the time return just laggy as sin and I can't do what I need to?

Thanks for the input!!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Stuck on TIME_PLAYED_MSG delay

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off