cant get Status(unit) to work (only tested on mobs) using the built in health absolute short.
"local s = Status(unit)
if s then
return s
end
return "%s/%s",Short(HP(unit),true),Short(MaxHP(unit),true)"
aka I killed a mob and it only showed up as (example) 0/324 where I would think it should be "Dead 0/324"
Yeah I screwed up some of the stuff in Status when I added the timers. I'll be fixing this shortly. Fixed.
There's a typo in ScriptEnv.lua (line 701 from the latest commit). The function currently reads:
local function MaxXP(unit)
if unit == "player" then
return UnitXPMax(unit)
elseif unit == "pet" and unit == "playerpet" then
local _, max = GetPetExperience()
return max
else
return 0
end
end
Line 701 should read:
elseif unit == "pet" or unit == "playerpet" then
This obviously had the effect of making MaxXP not work on your pet frame, which I had already worked around by calling GetPetExperience() directly on that frame.
Side note: Shefki, you're quite the coding monster! I'm impressed with how much stuff you've gotten out so quickly.
There's a typo in ScriptEnv.lua (line 701 from the latest commit). The function currently reads:
Probably should just dump unit == "playerpet" entirely. PB4 never feeds us units like that. Small artifact from DogTags and it needing to support CowTip et al.
Side note: Shefki, you're quite the coding monster! I'm impressed with how much stuff you've gotten out so quickly.
I spent most of this weekend working on this. Outside of some raiding and going to a movie. But in all fairness. I had DogTags to cheat off of.
I am trying to export the PowerColor tag and this is the furthest I could get:
local powerType = UnitPowerType(unit)
local r,g,b
if powerType == 0 then
r,g,b = { 48/255, 113/255, 191/255 }
elseif powerType == 1 then
r,g,b = { 226/255, 45/255, 75/255 }
elseif powerType == 2 then
r,g,b = { 1, 210/255, 0 }
elseif powerType == 3 then
r,g,b = { 1, 220/255, 25/255 }
elseif powerType == 6 then
r,g,b = { 0, 209/255, 1 }
else
r,g,b = { 0.8, 0.8, 0.8 }
end
if value then
return ("|cff%02x%02x%02x%s|r"):format(r * 255, g * 255, b * 255, value)
else
return ("|cff%02x%02x%02x"):format(r * 255, g * 255, b * 255)
end
As soon as I paste it in PB4, I get CTD with a #132 error. I also don't know how to reference the power colors using the SV.
Any help with this and with a DogTag->LuaText conversion of HPColor would be much much appreciated.
I'll make an effort to go through and pull in more of the color stuff from DogTags for you guys. And for the love of god don't make tables in these scripts. If you want performance you don't want to be producing a bunch of garbage.
During my raid tonight, at some point during combat my Health text, which was set to Health Percent (the standard one), switched to "Offline (0:00)" and stayed that way for a while. I didn't see any errors, and I really don't know what caused it. Curse client should have kept me up to date -- maybe something else is going on with the status texts.
Thanks so much Shefki! You're awesome!
Btw as I messed around some until I had the afk/dnd/playername thing the way I wanted it I thought I share it. I know it's not really a complicated code, but maybe it helps someone...
Classcoloured/outlined playername with :afktime when afk or :DND when DND
local r,g,b = ClassColor(unit)
Outline()
if UnitIsAFK(unit) then
return "|cff%02x%02x%02x%s:|r%s",r,g,b,Name(unit),FormatDuration(AFKDuration(unit))
elseif UnitIsDND(unit) then
return "|cff%02x%02x%02x%s:DND|r",r,g,b,Name(unit)
else
return '|cff%02x%02x%02x%s|r ',r,g,b,Name(unit)
end
During my raid tonight, at some point during combat my Health text, which was set to Health Percent (the standard one), switched to "Offline (0:00)" and stayed that way for a while. I didn't see any errors, and I really don't know what caused it. Curse client should have kept me up to date -- maybe something else is going on with the status texts.
Yeah someone mentioned it earlier. I'd been seeing it but I hadn't tracked down what was causing it. It wasn't obvious. At any rate the most recent push fixes it.
local cur = Power(unit)
local max = MaxPower(unit)
local percent = Percent(cur,max)
local _, type = UnitPowerType(unit)
local r, g, b = unpack(PitBull4.PowerColors[type])
return "|cff%02x%02x%02x%s|r", r*255, g*255, b*255, cur
Occasionally that "unpack" line in there fails with nil error. As far as I can tell every possible "type" has a matching PitBull color, so I don't understand why my DK with "RUNIC_POWER" isn't being colored properly. :( BTW, these are obviously the PitBull4 bar colors, not the DogTag power colors, so they might be hard to read for some.
And this is what my HealthColor looks like:
local cur = HP(unit)
local max = MaxHP(unit)
local percent = Percent(cur,max)
return "|cff%02x%02x%02x%s|r", (100 - percent) * 2.55, percent * 2.55, 0, cur
I didn't actually check the DogTag code, but this seems to fade from Green to Red fairly well.
BTW Shefki, I'm running 100% LuaTexts now and it's really satisfying. I didn't have the presence of mind to do any benchmarking though. Having the coloring stuff built-in would be terrific.
I know you are reading this, Shefki so ill post it here;P
You seem to have forgotten to add PVP check in Hostilecolor function when rewriting it from dogtags. At least it looks like so since friendly players are marked as civillians.
local cur = Power(unit)
local max = MaxPower(unit)
local percent = Percent(cur,max)
local _, type = UnitPowerType(unit)
local r, g, b = unpack(PitBull4.PowerColors[type])
return "|cff%02x%02x%02x%s|r", r*255, g*255, b*255, cur
Occasionally that "unpack" line in there fails with nil error. As far as I can tell every possible "type" has a matching PitBull color, so I don't understand why my DK with "RUNIC_POWER" isn't being colored properly. :( BTW, these are obviously the PitBull4 bar colors, not the DogTag power colors, so they might be hard to read for some.
I know for a fact that we don't have every power type in PowerColors. I've run into some stuff that we're not handling properly and I just haven't gotten to it. You should do something along the lines of:
local color = PitBull4.PowerColors[type]
local r,g,b
if color then
r,g,b = color[1],color[2],color[3]
else
r,g,b = 0.7, 0.7, 0.7
end
After thinking more about this, I wouldn't bother to use unpack. It's an extra function call that's unnecessary. Certainly cleaner looking but one function call for three table indexes isn't really a useful performance tradeoff.
BTW Shefki, I'm running 100% LuaTexts now and it's really satisfying. I didn't have the presence of mind to do any benchmarking though. Having the coloring stuff built-in would be terrific.
Useful benchmarking is incredibly difficult to do on this stuff anyway because you can't really control the conditions in a raid environment. I did a lot of work on improving idle time performance because it's incredibly easy to control the conditions of idling. Plus, if there's a performance problem while idling it's probably worse when in a raid situation. Though, that's not always true.
At any rate, a lot of my tuning work for raid stuff is based on more anecdotal feelings of how the game is performing. Am I noticing stuttering... It's not really scientific but it's still useful.
So feedback even if it isn't scientific is helpful. It's impossible for me to have every configuration available and honestly I have a pretty decent computer so some of the performance issues aren't as noticeable to me as they are to other people.
My ultimate goal is as Allara put it, smooth like butter frame rates.
(if HasAura("Unbalancing Strike") then
Icon("Interface/Icons/ability_warrior_decisivestrike", size=17)
end)
How would this look like in Luatexts?
if UnitAura(unit,"Unbalancing Strike",nil,"HARMFUL") then
-- something
end
Honestly, I have no idea how to put icons in FontStrings. I simply haven't looked at how that is implmented. I'll probably add a function like Icon to help with that. I just haven't gotten to it. I'm assuming there's some sort of escape code to put them in.
A question: suppose i'm working on raid frame, so "unit" points to a raid member.
How can i retrieve name of that player's pet?
What i'm aiming for is to make raid members name shown even if they are in vehicle, without using pet frame. (But retaining other features of that player-pet exchange, like vehicle healt on bar etc..)
Or should i refer to something like unit's driver? Since so far it seems like player is becoming vehicle's "pet" when entering vehicle.
The Name(unit) convenience function already does the work to handle this for you. Trust me when I say that you don't want to bother to implement this on your own.
However the name of a players pet from a purely Blizzard API stand point is:
UnitName(unit.."pet")
I know you are reading this, Shefki so ill post it here;P
You seem to have forgotten to add PVP check in Hostilecolor function when rewriting it from dogtags. At least it looks like so since friendly players are marked as civillians.
Hmm the color stuff was largely copy and paste jobs, but I'll look into it.
Enjoying the new LuaTexts a lot. In fact I'm finding most of my Dogtags easier to rewrite in Lua thanks to being able to use variables. I have one question:
Is there some way to implement wrapping in a textstring? I did an ugly job of this in DogTags by replacing all spaces with \n but I do not know enough about Lua to know whether this can be done. Or is it possible to add this feature to Pitbull itself?
On a related note, I've noticed that while left aligned strings truncate, right aligned strings do not and the text continues outside of the frame it's in. Or at least that's the case on frames that are mirrored horizontally.
Honestly, I have no idea how to put icons in FontStrings. I simply haven't looked at how that is implmented. I'll probably add a function like Icon to help with that. I just haven't gotten to it. I'm assuming there's some sort of escape code to put them in.
OK, thanks. The Icon isn't that important for me right now. So temporarily it should be no problem using some sort of text indicator instead.
EDIT:
About counting buffs or debuffs, e.g. Sanity on Yogg:
if UnitAura(unit,"Sanity",nil,"HARMFUL") then
local _,_,_,count,_,_,_,_,_ = UnitAura(unit,"Sanity",nil,"HARMFUL")
return count
end
The Name(unit) convenience function already does the work to handle this for you. Trust me when I say that you don't want to bother to implement this on your own.
However the name of a players pet from a purely Blizzard API stand point is:
UnitName(unit.."pet")
Where unit is the unit for the player.
Actually it does exactly what i don't want, it shows vehicle name;P
elseif unit:match("%d*vehicle%d*$") then
return VehicleName(unit)
end
On every frame where is vehicle i want driver's name shown instead of vehicle.
Anyway thanks for info.
edit: took a close look and there is a bug in whole VehicleName function.
For now output is "Darkspear Raptor's Darkspear Raptor" xD
I'll try to look further and pick it out.
Yeah I screwed up some of the stuff in Status when I added the timers. I'll be fixing this shortly. Fixed.
Line 701 should read:
This obviously had the effect of making MaxXP not work on your pet frame, which I had already worked around by calling GetPetExperience() directly on that frame.
Side note: Shefki, you're quite the coding monster! I'm impressed with how much stuff you've gotten out so quickly.
Probably should just dump unit == "playerpet" entirely. PB4 never feeds us units like that. Small artifact from DogTags and it needing to support CowTip et al.
I spent most of this weekend working on this. Outside of some raiding and going to a movie. But in all fairness. I had DogTags to cheat off of.
As soon as I paste it in PB4, I get CTD with a #132 error. I also don't know how to reference the power colors using the SV.
Any help with this and with a DogTag->LuaText conversion of HPColor would be much much appreciated.
Btw as I messed around some until I had the afk/dnd/playername thing the way I wanted it I thought I share it. I know it's not really a complicated code, but maybe it helps someone...
Classcoloured/outlined playername with :afktime when afk or :DND when DND
Yeah someone mentioned it earlier. I'd been seeing it but I hadn't tracked down what was causing it. It wasn't obvious. At any rate the most recent push fixes it.
Occasionally that "unpack" line in there fails with nil error. As far as I can tell every possible "type" has a matching PitBull color, so I don't understand why my DK with "RUNIC_POWER" isn't being colored properly. :( BTW, these are obviously the PitBull4 bar colors, not the DogTag power colors, so they might be hard to read for some.
And this is what my HealthColor looks like:
I didn't actually check the DogTag code, but this seems to fade from Green to Red fairly well.
BTW Shefki, I'm running 100% LuaTexts now and it's really satisfying. I didn't have the presence of mind to do any benchmarking though. Having the coloring stuff built-in would be terrific.
How would this look like in Luatexts?
You seem to have forgotten to add PVP check in Hostilecolor function when rewriting it from dogtags. At least it looks like so since friendly players are marked as civillians.
I know for a fact that we don't have every power type in PowerColors. I've run into some stuff that we're not handling properly and I just haven't gotten to it. You should do something along the lines of:
After thinking more about this, I wouldn't bother to use unpack. It's an extra function call that's unnecessary. Certainly cleaner looking but one function call for three table indexes isn't really a useful performance tradeoff.
Useful benchmarking is incredibly difficult to do on this stuff anyway because you can't really control the conditions in a raid environment. I did a lot of work on improving idle time performance because it's incredibly easy to control the conditions of idling. Plus, if there's a performance problem while idling it's probably worse when in a raid situation. Though, that's not always true.
At any rate, a lot of my tuning work for raid stuff is based on more anecdotal feelings of how the game is performing. Am I noticing stuttering... It's not really scientific but it's still useful.
So feedback even if it isn't scientific is helpful. It's impossible for me to have every configuration available and honestly I have a pretty decent computer so some of the performance issues aren't as noticeable to me as they are to other people.
My ultimate goal is as Allara put it, smooth like butter frame rates.
Honestly, I have no idea how to put icons in FontStrings. I simply haven't looked at how that is implmented. I'll probably add a function like Icon to help with that. I just haven't gotten to it. I'm assuming there's some sort of escape code to put them in.
The Name(unit) convenience function already does the work to handle this for you. Trust me when I say that you don't want to bother to implement this on your own.
However the name of a players pet from a purely Blizzard API stand point is:
UnitName(unit.."pet")
Where unit is the unit for the player.
Hmm the color stuff was largely copy and paste jobs, but I'll look into it.
Is there some way to implement wrapping in a textstring? I did an ugly job of this in DogTags by replacing all spaces with \n but I do not know enough about Lua to know whether this can be done. Or is it possible to add this feature to Pitbull itself?
On a related note, I've noticed that while left aligned strings truncate, right aligned strings do not and the text continues outside of the frame it's in. Or at least that's the case on frames that are mirrored horizontally.
OK, thanks. The Icon isn't that important for me right now. So temporarily it should be no problem using some sort of text indicator instead.
EDIT:
About counting buffs or debuffs, e.g. Sanity on Yogg:
Is this right?
Yes, it's right. However you don't have to write _ after variables you are interested in, it will be automatically skipped.
Actually it does exactly what i don't want, it shows vehicle name;P
On every frame where is vehicle i want driver's name shown instead of vehicle.
Anyway thanks for info.
edit: took a close look and there is a bug in whole VehicleName function.
For now output is "Darkspear Raptor's Darkspear Raptor" xD
I'll try to look further and pick it out.
edit2: found it:
See it?;P
That would work but you shouldn't call UnitAura twice for the same info:
UnitAura with a buff/debuff name is almost certainly asking UnitAura to walk the auras for us in C space. Unnecessary iteration sucks up CPU time.