Totem Tag - help needed
Hi all!
Can someone tell me what's wrong with the following tag? Code:
oUF.Tags.Methods["shrooms"] = function(u) |
Do you have Lua errors turned on or BugSack installed?
|
Yes I do. None whatsoever.
Btw, I just came back after a 2y break, and I remember you (esp. for being helpfull). Nice to see you around still :) |
Actually on second glance, I think this is your problem:
Code:
("|cFF%.2x%.2x%.2x%s|r"):format(color[1] * 255, color[2] * 255, color[3] * 255, count) For example, format("%02f", 10 / 3) == "03.33333333333333333", but format("%.2f", 10 / 3) == "3.33". So, if your color values are 1, 0.5, and 0 then you're converting them into ff (ok), 99 (ok) and 0 (not ok) to end up with "|cffff990<<count>>|r" which isn't a valid color code. Technically you are producing a valid color code when combined with your count, since 1, 2, and 3 are valid hexadecimal values -- "|cffff9903|r" -- but then you don't have any text to display. :p Also, ("text"):format(...) is the slowest possible method of formatting a string. Use format("text", ...) instead: Code:
return format("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, count) |
Thanks for your suggestions. I tried it, but to no avail :( I also inserted a print statement, and it seems clear to me the function is never called. I did confirm PLAYER_TOTEM_UPDATE fires when I plant a mushroom... might have something to do with the unitless events, but I have no idea how to check for that.
I did run this script ingame: Code:
local event = 'PLAYER_TOTEM_UPDATE' (e) I just remembered, there's another tag that's not working. I didn't want to ask 2 questions at once, but maybe they're connected? The other tag is Code:
oUF.Tags.Events['BossBars:health'] = oUF.Tags.Events["curhp"] .. " " .. oUF.Tags.Events["maxhp"] |
Well here is an example tag from my own layout that is definitely working with a "unitless" event:
Code:
oUF.Tags.Events["restingicon"] = "PLAYER_UPDATE_RESTING" Code:
oUF.Tags.Events["mushrooms"] = "PLAYER_TOTEM_UPDATE" For your health tag, I suspect the problem is the way you are listing events. Rather than concatenating the events from other tags (which may or may not be defined yet when your code runs) just write out the events; there are only two of them. Also, you don't need to explicitly return an empty string or a zero if there's no value; just don't return anything, and the fontstring will be emptied. Code:
oUF.Tags.Events["BossBars:health"] = "UNIT_HEALTH UNIT_MAXHEALTH" |
I tried the things you suggested, to no avail... this is all very strange. I confirmed that oUF.Tags.Events and oUF.Tags.SharedEvents contain the right entries for the mushrooms tag, and oUF.Tags.Methods["mushrooms"] is the right function (I can execute it and then read the print statement). I can _also_ see that the function that Totem_Frame has registered for OnEvent is _not_ the one from oUF.Tags.Methods["mushrooms"]. Probably because of oUF internals, but executing that OnEvent function does not print anything... I also changed the function to function(), because PLAYER_TOTEM_UPDATE does not give an argument (so unit would be nil), but that also didn't change anything.
As for the BossBars:health tag, there's no entry in oUF.Tags.Events or oUF.Tags.Methods for it, so I'll have to see if dependencies are right and the code gets executed. Funky though that the tag updates at all, and the unitframe itself works nicely. (e) Wait, I got an idea. I use Tukui, which brings it's own version of oUF, but I don't use the unitframes, so I've installed oUF itself, too. I bet there's some kind of conflict going on. I'll sort that out tonight and then report if the problem persists. Thanks for helping so far! |
Hrrmmm, I resolved it, but it doesn't really change a lot, since the ouf from tukui lives in its own namespace. I made the bossbars use the standard ouf, so I can now find the tag's entries in oUF.Tags and its subtables correctly. Still, both tags don't work, just as I described above.
The only additional info that I found is that the bosshealth tag doesn't really update when I change targets, but only when I target the boss in question. Given that the entries in oUF.Tags and its subtables look totally correct, I find that really weird. Now, I'd still be grateful for any hints or ideas what to check. (e) Well well, another thing turns up. I realized there's a tag for hp percentage in stock ouf... so I didn't need my bossbars health tag. So I tagged the fontstring with perhp... and behold, the problem _still_ persists. So it might be a bug in ouf? Still no dice with the mushrooms though... (ee) Ok, Boss thingy is explained here: http://www.wowinterface.com/forums/s...ad.php?t=46127 |
Quote:
Quote:
|
Quote:
Anyways, going forward. I manually made a frame, registered PLAYER_TOTEM_UPDATE and set the OnEvent script, and everything worked well. I also realized that by the code above, that event is only registered for TotemFrame, which is from the standard UI. Means, oUF doesn't even register that event, right? So either I'm doing something wrong here or there's a bug somewhere. I'll try to figure out the oUF code on this... |
Well, don't I feel stupid now :( I mean, more than usual...
Here's how I made the fontstring: Code:
if TukuiDB.myclass == "DRUID" then I found this by traversing ouf's code with print statements. Not trying to blame anyone else for my own stupidity, but is there a reason ouf does not print an error message along the lines of "Dude, your tag's fontstring is nil"? Anyways, thanks for reading, special thanks to phanx for some handholding. I DID learn quite a bit, so it's not a total loss :) |
Quote:
Code:
local Tag = function(self, fs, tagstr) |
All times are GMT -6. The time now is 02:44 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI