 |
06/14/09, 6:18 PM
|
#1
|
|
Piston Honda
Undead Mage
Jaedenar (EU)
|
LuaTexts - The new DogTags
"LuaTexts is a text provider module for PitBull4. It's a more efficient alternative to DogTagTexts. Texts are entered using Lua rather that DogTags. Custom texts are harder to write than DogTags as it requires some knowledge of Lua."
Shefki (co-author of PitBull4) writes:

State of PB4:
As of the push tonight I believe the major performance issues are taken care of and generally serious bugs are fixed. There are of course a few here and there and some feature enhancements I'd really like to do. But the point here is that I consider us pretty much to be pretty much to a beta state.
While I consider us to be at that point I won't be immediately tagging the project as a beta. I'm gonna let PB4 simmer for a little bit to see if some things come up. I figure it'll get tagged probably sometime this weekend.
All that being said I wanted to talk about performance. Particularly as to how it is going to impact this timeline. I'm very interested in performance problems. PitBull in the past has had adequate performance, but it still has been somewhat lacking. I think we can provide the configuration options that our picky users want while still maintaining top notch performance.
As of the changes tonight during a typical AV run PB3+DogTags will use about 3.6 seconds of CPU time per minute of battleground time. PB4 using LuaTexts is using about 2.5 seconds of CPU time per minute of battleground time. PB4+DogTags is using about 6.4 seconds of CPU time per minute of battleground time.
The above is with roughly identical configurations between the 3 different setups. The DogTag performance numbers is including the time the LibDogTags-3.0 and LibDogTags-Unit-3.0 libraries took (PitBull was the only addon using them).
I strongly recommend that people still using DogTags and having performance problems migrate to LuaTexts. When reporting performance problems please do say if you're using DogTagTexts or LuaTexts, as you can see there is a drastic performance difference.
I have a pretty good idea as to what is causing the performance problems with DogTagTexts. Unfortunately, I don't have a very good solution for the problem. DogTags was largely written with PitBull3 and CowTip in mind. PitBull3 puts a lot of work on the individual modules to know when to update frames, particularly frames that we do not receive events for. PB4 includes this work in the core. Unfortunately, DogTags takes on this work and it gets doubled up. This explains the performance numbers seen above as the PB4 number is slightly less than double the PB3 DogTag number.
As a result of this it's almost guaranteed that I'll be switching the default text provider to LuaTexts.
I want to be clear that I'm not giving up on fixing DogTagsTexts. However, it was always the intention of making a lighter weight text provider be the default. I'm going to encourage people to shift to LuaTexts pretty strongly. I hope this post helps people make the decision to switch.
I also hope it demonstrates that PB4 is at this point outperforming PB3 with the exception of DogTags. I look forward to your feedback.
|
This thread is intended to work as The DogTags 3.0 Thread, but obviously for LuaTexts instead. Unsure how to get started? Check this out.
|
|
|
|
|
06/14/09, 10:05 PM
|
#2
|
|
Von Kaiser
|
I'll try to keep an eye on this thread and answer questions if need be. I'm really hoping that a community will spring up around LuaTexts to help people out with them. However, LuaTexts is PB4 centric. So there probably won't be as there was with people using DogTags with Cowtip, PB3 and others.
While I'll reply I'm not gonna generally get in the mode of converting every DogTag someone happens to post here. If the tag you want converted is instructive to the community then it will probably get converted. So don't feel slighted if I don't specifically respond to your post.
|
|
|
|
|
06/15/09, 3:19 AM
|
#3
|
|
Von Kaiser
|
I'll bite first. I'd like to get rid of Grid and only use PB4. I tried I but failed to write a "Missing Buff" Dogtag, and had to settle for a "Has Buff" tag. Something like
[if hasaura ("arcane briallance") "."]
I'd like to make a Lua Script to do something like
[if hasuara ("Aracne Briallance")nil, else "."]
Can anyone point me in the right direction?
Last edited by Dankz : 06/15/09 at 4:58 AM.
|
|
|
|
|
06/15/09, 4:36 AM
|
#4
|
|
Piston Honda
Undead Death Knight
Draenor (EU)
|
Little question:
the UF addon Stuf also has a .lua method for inputting your values for HP and such. Do you reckon this will work the same? Or will it work totally different?
|
|
|
|
06/15/09, 2:04 PM
|
#5
|
|
Von Kaiser
|
Originally Posted by Dankz
I'll bite first. I'd like to get rid of Grid and only use PB4. I tried I but failed to write a "Missing Buff" Dogtag, and had to settle for a "Has Buff" tag. Something like
[if hasaura ("arcane briallance") "."]
I'd like to make a Lua Script to do something like
[if hasuara ("Aracne Briallance")nil, else "."]
Can anyone point me in the right direction?
|
local i = 1
local fort,spirit,shadow_prot = true,true,true
while true do
local name,_,icon = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Power Word: Fortitude" then
fort = false
elseif name == "Divine Spirit" then
spirit = false
elseif name == "Shadow Protection" then
shadow_prot = false
end
i = i + 1
end
return "%s%s%s",fort and "|TPATH_TO_FORT_ICON:0|t" or '',spirit and "|TPATH_TO_SPIRIT_ICON:0|t" or '',shadow_prot and "|TPATH_TO_SHADOW_PROT_ICON:0|t" or ''
The above is the code I worked up to demonstrate to someone how to do it with icons. Should be pretty simple to modify that to do what you wanted.
|
|
|
|
|
06/15/09, 2:05 PM
|
#6
|
|
Von Kaiser
|
Originally Posted by Led ++
Little question:
the UF addon Stuf also has a .lua method for inputting your values for HP and such. Do you reckon this will work the same? Or will it work totally different?
|
Honestly, I haven't looked at the implementation in Stuf. So I really can't say. Lua itself of course will be the same, but I provide helper functions with are going to be different and I'm not sure if Stuf expects you to return a single string or the arguments to SetFormattedText like LuaTexts does.
|
|
|
|
|
06/15/09, 3:25 PM
|
#7
|
|
Glass Joe
|
I can't seem to concat with '..' in the texts code, I just get an error. Is there another way to write this?
if MaxPower(unit) > 0 then
return "|cff3da5ee"..Short(Power(unit))
end
edit: figured it out, had to add format boolean to Short()
Last edited by Katae : 06/15/09 at 3:34 PM.
|
|
|
|
|
06/15/09, 3:34 PM
|
#8
|
|
Piston Honda
|
Edit; He fixed it himeslf
|
|
|
|
|
06/15/09, 3:50 PM
|
#9
|
|
Von Kaiser
|
Originally Posted by Katae
I can't seem to concat with '..' in the texts code, I just get an error. Is there another way to write this?
if MaxPower(unit) > 0 then
return "|cff3da5ee"..Short(Power(unit))
end
edit: figured it out, had to add format boolean to Short()
|
Don't do concat like that. Do this:
If MaxPower(unit) > 0 then
return |cff3da5ee%s|r",Short(Power(unit),true)
end
Doing that avoids producing a lot of unnecessary garbage.
|
|
|
|
|
06/15/09, 5:18 PM
|
#10
|
|
Don Flamenco
|
[HP:Short "/" MaxHP:Short " " (if PercentHP > 70 then
PercentHP:VeryShort:Percent:Green
elseif PercentHP > 35 then
PercentHP:VeryShort:Percent:Yellow
elseif PercentHP < 35 then
PercentHP:VeryShort:Percent:Red
end)]
This is what Ive been using to show currhp/maxhp and a color coded percentage. Is there any way to do a more graduated coloring in lua text?
Last edited by Wodahs : 06/15/09 at 5:20 PM.
Reason: clarity
|
|
|
|
|
06/15/09, 6:16 PM
|
#11
|
|
Von Kaiser
|
Originally Posted by Wodahs
[HP:Short "/" MaxHP:Short " " (if PercentHP > 70 then
PercentHP:VeryShort:Percent:Green
elseif PercentHP > 35 then
PercentHP:VeryShort:Percent:Yellow
elseif PercentHP < 35 then
PercentHP:VeryShort:Percent:Red
end)]
This is what Ive been using to show currhp/maxhp and a color coded percentage. Is there any way to do a more graduated coloring in lua text?
|
HPColor(cur,max) though I really don't understand why you didn't just use HPColor in DogTags like so:
[HP:Short "/" MaxHP:Short " " PercentHP:VeryShort:Percent:HPColor]
which would be like so in LuaTexts:
local cur,max = HP(unit),MaxHP(unit)
local r,g,b = HPColor(cur,max)
return "%s/%s |cff%02x%02x%02x%s%%|r",cur,max,r,g,b,VeryShort(Percent(cur,max),true)
|
|
|
|
|
06/15/09, 7:10 PM
|
#12
|
|
Piston Honda
|
So I have spent a few hours on this and am throwing my hands in the air. I feel like I am so close to having it working (probably not optimal, but working). My bugsack is showing everything fine until the return line
Dogtag version:
[if IsEnemy and ~IsPet then
(if HasAura("Thunder Clap") or HasAura("Frost Fever") or HasAura("Infected Wounds") then
"T ":Green
else
"T ":Red
end)
end]
[if IsEnemy and ~IsPet then
(if HasAura("Curse of the Elements") or HasAura("Earth and Moon") or HasAura("Ebon Plague") then
"D ":Green
else
"D ":Red
end)
end]
[if IsEnemy and ~IsPet then
(if HasAura("Faerie Fire") or HasAura("Misery") then
"H ":Green
else
"H ":Red
end)
end]
[if IsEnemy and ~IsPet then
(if HasAura("Master Poisoner") or HasAura("Heart of the Crusader") or HasAura("Totem of Wrath") then
"C ":Green
else
"C ":Red
end)
end]
[if IsEnemy and ~IsPet then
"" (if HasAura("Judgement of Wisdom") then
"W ":Green
else
"W ":Red
end)
end]
My attempt at LuaText version:

local i = 1
local ttw,dam,hit,crit,wisdom= false,false,false,false,false
local tr,tg,tb = FF,00,00
local dr,dg,db = FF,00,00
local hr,hg,hb = FF,00,00
local cr,cg,cb = FF,00,00
local wr,wg,wb = FF,00,00
while true do
local name,_,icon = UnitAura(unit,i,"HARMFUL")
if not name then
break
elseif name == "Thunder Clap" then
ttw = true
elseif name == "Infected Wounds" then
ttw = true
elseif name == "Icy Touch" then
ttw = true
elseif name == "Earth and Moon" then
dam = true
elseif name == "Ebon Plague" then
dam = true
elseif name == "Curse of Elements" then
dam = true
elseif name == "Misery" then
hit = true
elseif name == "Faerie Fire" then
hit = true
elseif name == "Totem of Wrath" then
crit = true
elseif name == "Heart of the Crusader" then
crit = true
elseif name == "Judgment of Wisdom" then
wisdom = true
end
i = i + 1
end
if ttw then
tr,tg,tb = 00,FF,00
elseif dam then
dr,dg,db = 00,FF,00
elseif hit then
hr,hg,hb = 00,FF,00
elseif crit then
cr,cg,cb = 00,FF,00
elseif wisdom then
wr,wg,wb = 00,FF,00
end
return “|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r" ,tr,tg,tb,"T |n",dr,dg,db,"D |n",hr,hg,hb,"H |n",cr,cg,cb,"C |n",wr,wg,wb,"W |n" or ‘’
edit: I haven't even bothered to add the "IfEnemy" portion
|
|
|
|
|
06/16/09, 5:55 AM
|
#13
|
|
Great Tiger
Kalroth
Orc Warrior
No WoW Account (EU)
|
Originally Posted by Hotan
So I have spent a few hours on this and am throwing my hands in the air. I feel like I am so close to having it working (probably not optimal, but working). My bugsack is showing everything fine until the return line
return “|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r" ,tr,tg,tb,"T |n",dr,dg,db,"D |n",hr,hg,hb,"H |n",cr,cg,cb,"C |n",wr,wg,wb,"W |n" or ‘’
|
If this is a direct paste from your Lua code, then the first quote character is incorrect.
You're using “ when you should be using ". Also I believe that the or ‘’ part should be or "".
|
|
|
|
|
06/16/09, 7:07 AM
|
#14
|
|
Glass Joe
Tauren Hunter
Burning Legion (EU)
|
Your text formatting looks kinda weird.
I wonder why are you using something like
"|cff%02x%02x%02x%s|r", tr,tg,tb,"T |n"
when it can be like
"|cff%02x%02x%02xT|r|n", tr,tg,tb
Notice where 'T' went. This way it's more uniform.
And of course take into account what Kalroth said about quotation marks.
BTW if it doesn't help, could you paste what bugsack said about that return line?
edit: forgot |n
|
|
|
|
|
06/16/09, 12:22 PM
|
#15
|
|
Piston Honda
|
Sweet, thanks for the feedback. All my lua knowledge is coding by mimicing, so...yeah.
Once maintenance is over I'll do this stuff. The spaces are there for a reason, I have the text vertically on the left edge, but I don't want it on the edge of the frame, but rather right next to it.
btw: what exactly does |r mean?
Last edited by Hotan : 06/16/09 at 12:28 PM.
|
correlation =/= causation
|
|
|
|