Exactly. My code won't be blocked by the GUI.
Exactly. My code won't be blocked by the GUI.
The error hasn't occured since I posted, XD
As for the code, it works amazing. I can't thank you enough. Now if only Blizzard would fix their Floating Combat Text so I could see how much damage each move is doing, XD
The error's back, but it seems to only affect my characters that use PowerAurasClassic, so I assume something with it is causing the errors. But it only affects them if this addon is enabled at the same time. :S
I've used this "addon" (read: code) for a couple of weeks now and since 2 weeks ago (I guess latest patch 4.0.1a) I keep having "UI failed because of an addon" or some sort of error.
when at that point I rightclick a buff it says that the problem is the addon, i called it "health&percent".
Is there some thing in the code that needs to be changed after this patch? Cause it does my head in!
I do like to point out that its an sweet addon, just a bit buggy for me :'(
PS: I dont use any buff display addons that could be it. But it is saying that this code is causing the problem.
I don't see anything that might be blocked by the default UI there.
Really odd, cause that's the only thing that's causing issues that i cant click off my buffs, its giving the reply that the failure in the UI is caused by this addon.
It occurs only once or twice a week, so its nothing that annoying but its just odd.
I'll see if it gets better after the next patch since this one is very buggy for me in general.
(unable to loot some, cant see some items - refusing to load, unable to inspect at times - no i dont use gearscore, and some other things, we'll see..)
The addon doesn't even as much as touch your buff frames.
Treeston, thank you for you time for creating this code, it is almost a perfect replacement for what I used MobInfo2 for. The only other thing that I miss from MI2 is the ToolTip health for when you hover over a mob.
Now that MI2 is broken again with the 4.0.6 patch, is there any chance you could provide code to add this function to the ToolTip?
Thanks again!
Last edited by Neema; 2011-02-10 at 09:52 PM.
Untested, obviously.Code:local function round(num, places) return tonumber(string.format("%."..(places or 0).."f",num)) end local function short(num) if num > 10000000 then return round(num/1000000, 1).."m" elseif num > 10000 then return round(num/1000, 1).."k" else return num end end local a = CreateFrame("Frame") a:SetScript("OnEvent", function() if not UnitExists("mouseover") then return end local uh, uhm = UnitHealth("mouseover"), UnitHealthMax("mouseover") GameTooltip:AddDoubleLine("Health", short(uh).."/"..short(uhm).." ("..round(uh/uhm*100,1).."%)", 1, 0.82, 0, 1, 1,1) end) a:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
Wow, thanks for the fast response!
I just tested it and it does add the mob health to the ToolTip, but unfortunately the health text is not lining up with the tooltip box and the tooltip box does not scale to the addition of the new text.
Here are two examples:
neemanet.net/images/tthealth01.jpg
neemanet.net/images/tthealth02.jpg
Sorry about the links, I can't post pictures yet.
Thanks again!
Code:local function round(num, places) return tonumber(string.format("%."..(places or 0).."f",num)) end local function short(num) if num > 10000000 then return round(num/1000000, 1).."m" elseif num > 10000 then return round(num/1000, 1).."k" else return num end end local a = CreateFrame("Frame") a:SetScript("OnEvent", function() if not UnitExists("mouseover") then return end local uh, uhm = UnitHealth("mouseover"), UnitHealthMax("mouseover") GameTooltip:AddDoubleLine("Health", short(uh).."/"..short(uhm).." ("..round(uh/uhm*100,1).."%)", 1, 0.82, 0, 1, 1,1) GameTooltip:Show() end) a:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
Thanks Treeston, that works like a charm! I love it, all the functions I needed in a nice light code base, perfect!
If you're using it in conjunction with the first code I posted (in the same file), you can cut off the two "local function ... end" chunks (everything in the new code before the
line) to preserve some more memory. I just placed them in the new code because I wanted it to work when used on its own as well.Code:local a = CreateFrame("Frame")
I was wondering about that, as I did combine the two code pieces together. Before removing the two chunks, this addon was only taking 6.1K of memory and it dropped to 5.3K after the update.
Thanks again for provide a nice lightweight piece of code to do exactly what I needed!
Last edited by Neema; 2011-02-12 at 12:48 PM.
It may sound strange, but what i loved most about MobInfo2, wasn't the Health-Display (which was covered by an Built-In-Plugin named MobHealth).
I truely miss the feature to collect the data of which mob dropped what and how often. And to search this said data for things like "leather" and to get the mobs with the best dropchance so far. Hell, you could even filter it by "drop", "herbalism", "mining", "skinning" and "Pick-Pocket" (all for mobs only), which was awesome for farming the dwarven-dice ,)
is there any possibility to get such feature back?
Last edited by mmoc50acda90bd; 2011-02-12 at 01:22 PM.
I made an addition to the code to include the mobs power/mana in the tooltip window. If there is a better way of doing this, please feel free to correct any mistakes in what I have done:
Note that this is to be added to the code provided by Treeston that adds health info to the mob frame.Code:local a = CreateFrame("Frame") a:SetScript("OnEvent", function() if not UnitExists("mouseover") then return end local uh, uhm = UnitHealth("mouseover"), UnitHealthMax("mouseover") local upp, uppm = UnitPower("mouseover"), UnitPowerMax("mouseover") local pt = {[0] = "Mana", [1] = "Rage", [2] = "Focus", [3] = "Energy", [4] = "Happiness", [5] = "Runes", [6] = "Runic Power", [7] = "Soul Shards", [8] = "Eclipse", [9] = "Holy Power"} local upt = UnitPowerType("mouseover") GameTooltip:AddDoubleLine("Health", short(uh).."/"..short(uhm).." ("..round(uh/uhm*100,1).."%)", 1,0.82,0, 1,1,1) if uppm > 0 then GameTooltip:AddDoubleLine(pt[upt], short(upp).."/"..short(uppm).." ("..round(upp/uppm*100,1).."%)", 0.5,0.5ss,1, 1,1,1) end GameTooltip:Show() end) a:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
Thanks!
Move the local pt declaration outside the function (to the top).
Thanks for the advice, was wondering why the memory requirement went up as much as it did.
I have some background in programming but I am pretty new to LUA.
Thanks for helping out!
Code:local a = CreateFrame("Frame") local pt = {[0] = "Mana", [1] = "Rage", [2] = "Focus", [3] = "Energy", [4] = "Happiness", [5] = "Runes", [6] = "Runic Power", [7] = "Soul Shards", [8] = "Eclipse", [9] = "Holy Power"} a:SetScript("OnEvent", function() if not UnitExists("mouseover") then return end local uh, uhm = UnitHealth("mouseover"), UnitHealthMax("mouseover") local upp, uppm = UnitPower("mouseover"), UnitPowerMax("mouseover") local upt = UnitPowerType("mouseover") GameTooltip:AddDoubleLine("Health", short(uh).."/"..short(uhm).." ("..round(uh/uhm*100,1).."%)", 1,0.82,0, 1,1,1) if uppm > 0 then GameTooltip:AddDoubleLine(pt[upt], short(upp).."/"..short(uppm).." ("..round(upp/uppm*100,1).."%)", 0.5,0.5ss,1, 1,1,1) end GameTooltip:Show() end) a:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
Last edited by Neema; 2011-02-12 at 08:56 PM.
You were basically re-creating the table every time your mouseover changed. Table creation is pretty hefty in Lua memory-wise.
I'm using your code Treeston and it's working like a charm , thank you , except for one little thing :
The mana value of people who are out of range and therefor not 'cached' is always around 25k , while the HP are immediatly shown correctly . Is this intended by Blizzard or can you update your Code ? Because MobInfo / MobHealth displayed the correct mana value in the past immediatly , regardless of the inspect range .
Oh , I'm using the german client , don't know if it makes any difference .