Quantcast UNIT_HEALTH vs UNIT_HEALTH_FREQUENT vs combat log parsing - WoWInterface
Thread Tools Display Modes
02-09-19, 05:47 PM   #1
Ethly
A Deviate Faerie Dragon
Join Date: Mar 2018
Posts: 19
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?
  Reply With Quote
02-09-19, 08:43 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 982
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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-09-19 at 11:26 PM.
  Reply With Quote
02-11-19, 09:53 PM   #3
d87
A Flamescale Wyrmkin
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 130
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.

Last edited by d87 : 02-11-19 at 10:02 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » UNIT_HEALTH vs UNIT_HEALTH_FREQUENT vs combat log parsing

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