WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   UNIT_HEALTH vs UNIT_HEALTH_FREQUENT vs combat log parsing (https://www.wowinterface.com/forums/showthread.php?t=57017)

Ethly 02-09-19 05:47 PM

UNIT_HEALTH vs UNIT_HEALTH_FREQUENT vs combat log parsing
 
I have the following snippet to test:
Code:

local frame = CreateFrame("Frame");
frame:RegisterUnitEvent("UNIT_HEALTH", "player");
frame:RegisterUnitEvent("UNIT_MAXHEALTH", "player");
frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player");
frame:SetScript("OnEvent", function(self, event, unit)
        print(event, unit, UnitHealth("player"), UnitHealthMax("player"));
end);

With this code I could see that UNIT_HEALTH_FREQUENT works as expected. But UNIT_HEALTH works very strange. First of all, this event fires a lot. On one character it fires 3 times for each UNIT_HEALTH_FREQUENT. On another character it fires like 20 times. And, what's the most strange, UnitHealth value is obsolete, it shows from previous tick or something. So I'm seeing
Code:

UNIT_HEALTH player 165 171
UNIT_HEALTH player 165 171
UNIT_HEALTH player 165 171
UNIT_HEALTH_FREQUENT 168 171
delay
UNIT_HEALTH player 168 171
UNIT_HEALTH player 168 171
UNIT_HEALTH player 168 171
UNIT_HEALTH_FREQUENT 171 171

and I don't even getting UNIT_HEALTH player 171 171 at all. I thought that UNIT_HEALTH is supposed to be throttled, so I could use it for insignificant frames, but it seems like it's just broken.

Also I want to ask whether it's worth it to parse combat log for more reactive health updates. It seems like a lot of effort, potentially buggy code because combat log parsing is not a easy task and it seems that sometimes it'll display wrong values no matter what. Is there any objective measurements of benefits?

Fizzlemizz 02-09-19 08:43 PM

Code:

local frame = CreateFrame("Frame");
frame:RegisterUnitEvent("UNIT_HEALTH", "player");
frame:RegisterUnitEvent("UNIT_MAXHEALTH", "player");
frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player");
frame.Count = 0
frame.Health = 0
frame:SetScript("OnEvent", function(self, event, unit)
        if self.Health == 0 then
                self.Health = UnitHealth("player")
        elseif self.Health ~= UnitHealth("player") then
                self:UnregisterAllEvents()
                return
        end
        if event == "UNIT_HEALTH" then
                self.Count = self.Count + 1
                print(event, self.Count, unit, UnitHealth("player"), UnitHealthMax("player"));
        end
end);

Using this, if something attacks me, the printed count is 1. If I /reload, get attacked then the count is 2. /reload again, get attacked the count is 3 etc.
Logout/Login and the count resets.

d87 02-11-19 09:53 PM

UNIT_HEALTH being repeated several times is a bug with the current patch. And it's so bad that it'll actually get a fix soon, i hope.
Regarding combat log, i used https://wow.curseforge.com/projects/...tloghealth-1-0 for years and yeah you get faster updates for the cost of increased cpu usage.
Sadly the same bug is messing it up currently.


All times are GMT -6. The time now is 07:27 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI