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."

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.

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.

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.

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.

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

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

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?

Your problem is the FF. That either needs to be 0xFF to say you're giving it a number in hex or it needs to be a decimal number 255.Fix that and it should work.

Also you need two loops one for "HARMFUL" and one for "HELPFUL" roughly:

while true do
local name = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Buff1" then
-- something
elseif name == "Butff2" then
-- somethingelse
end
i = i + 1
end
i = 1
while true do
local name = UnitAura(unit,i,"HARMFUL")
if not name then
break
elseif name == "Debuff1" then
-- something
elseif name == "Debuff2" then
--something else
end
i = i + 1
end

Hex/base10 ARRRGHG. To be clear %02x means you are giving it numbers and 0xFF means you are giving it hex?? I'm not quite clear with how to input it as hex, although it isn't hard to input as base10.

I know I need two loops for HARMFUL and HELPFUL. There is only going to be one loop, HARMFUL in the final version. In the test form it just won't find some things it is looking for because they aren't relevant.

For people who are interested (prevent further questions) here is an image of the tag in action, and the code I am ending up using:

if not UnitIsFriend(unit,'player') then
local i = 1
local ttw,dam,hit,crit,wisdom= false,false,false,false,false
local tr,tg,tb = 255,00,00
local dr,dg,db = 255,00,00
local hr,hg,hb = 255,00,00
local cr,cg,cb = 255,00,00
local wr,wg,wb = 255,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 == "Master Poisoner" 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,255,00
end
if dam then
dr,dg,db = 00,255,00
end
if hit then
hr,hg,hb = 00,255,00
end
if crit then
cr,cg,cb = 00,255,00
end
if wisdom then
wr,wg,wb = 00,255,00
end
return "|cff%02x%02x%02xT|r |n|cff%02x%02x%02xD|r |n|cff%02x%02x%02xH|r |n|cff%02x%02x%02xC|r |n|cff%02x%02x%02xW|r "
,tr,tg,tb,dr,dg,db,hr,hg,hb,cr,cg,cb,wr,wg,wb
end

Hex/base10 ARRRGHG. To be clear %02x means you are giving it numbers and 0xFF means you are giving it hex?? I'm not quite clear with how to input it as hex, although it isn't hard to input as base10.

The %02x is the format code for the format. It says the variable in that place will be an integer... 0 means you want it zero padded, i.e. "1" would be "01", 2 means you want two places digits and the x means you want the output to be in hexadecimal with lowercase letters (a,b,c,d,e,f). This is entirely separate from inputting numbers in Lua.

The format the numbers are actually stored in Lua is irrevelent. Pretty much all languages assume you're entering numbers in base 10. If you want to enter the numbers in hexadecimal you'd do 0xFF. So your line:local tr,tg,tb = 255,00,00would be:local tr,tg,tb = 0xFF,0,0

The double zeros are redundent. Again Lua abstracts how it's storing the number from you. When you input numbers you have to say what you're using (or use the assumed default) and you have to tell it what you want when you output them, thus the %02x.

Alternatively you could use %s as your format string and use:local tr,tg,tb = 'FF','00','00'