"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
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?
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
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
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
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 "".
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?
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.
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,"HELPFUL")
if not name then
break
elseif name == "Molten Armor" then
ttw = true
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,FF,00
end
if dam then
dr,dg,db = 00,FF,00
end
if hit then
hr,hg,hb = 00,FF,00
end
if crit then
cr,cg,cb = 00,FF,00
end
if wisdom then
wr,wg,wb = 00,FF,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|n" ,tr,tg,tb,dr,dg,db,hr,hg,hb,cr,cg,cb,wr,wg,wb
I changed UnitAura(unit,i,"HARMFUL") to UnitAura(unit,i,"HELPFUL") and added elseif name == "Molten Armor" to aide testing, but I don't see how they could have caused any issues.
This is my bugsack report:
[2009/06/16 11:02:05-572-x1]: PitBull4_LuaTexts:Target - L:Lua:Debuff Check caused the following error::
bad argument #4 to 'SetFormattedText' (number expected, got nil):
PitBull4-r20090616012413\Modules\LuaTexts\LuaTexts.lua:639: in function <...erface\AddOns\PitBull4\Modules\LuaTexts\LuaTexts.lua:595>
PitBull4-r20090616012413\Modules\LuaTexts\LuaTexts.lua:1135: in function `AddFontString'
PitBull4-r20090616012413\ModuleHandling\TextProviderModule.lua:116: in function `UpdateFrame'
PitBull4-r20090616012413\ModuleHandling\Module.lua:271: in function `Update'
PitBull4-r20090616012413\UnitFrame.lua:527: in function `Update'
PitBull4-r20090616012413\UnitFrame.lua:553: in function `UpdateGUID'
PitBull4-r20090616012413\Main.lua:1136: in function `CheckGUIDForUnitID'
PitBull4-r20090616012413\Main.lua:1141: in function `?'
CallbackHandler-1.0-3:146: in function <...omp\libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:146>
<string>:"safecall Dispatcher[1]":4: in function <[string "safecall Dispatcher[1]"]:4>
<in C code>: ?
<string>:"safecall Dispatcher[1]":13: in function `?'
CallbackHandler-1.0-3:91: in function `Fire'
AceEvent-3.0-3:119: in function <...s\ArthicsRaidComp\libs\AceEvent-3.0\AceEvent-3.0.lua:118>
<in C code>: in function `TargetUnit'
Interface\FrameXML\SecureTemplates.lua:348: in function `handler':
Interface\FrameXML\SecureTemplates.lua:460: in function `SecureActionButton_OnClick':
Interface\FrameXML\SecureTemplates.lua:501: in function <Interface\FrameXML\SecureTemplates.lua:493>:
---
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
PS: Hidden debuffs are evil (ie Judgment of the Just)
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,00
would 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'
And be warned, using Angle() in the middle of params won't work right unless it's the last one. In retrospect I kinda wish I hadn't added them at all. But it sure made the default tags a little cleaner looking.
The reason you can only use it at the end is because Lua doesn't really have a list context.
function foo()
return 'a','b','c'
end
function bar()
return 1,2,foo(),3,4
end
print(bar())
Will print:
1 2 a 3 4
Changing bar to:
function bar()
return 1,2,3,4,foo()
end
will print:
1 2 3 4 a b c
So be warned that Angle() and Paren() will very likely fail you in some places.
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.
Ok I had a crack at it and did't work. This is what I'm using
local i = 1
local int,arc_brill,dala_brill = true,true,true
while true do
local name,_,icon = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Arcane Intellect" then
int = false
elseif name == "Arcane Brilliance" then
arc_brill = false
elseif name == "Dalaran Brilliance" then
dala_brill = false
end
i = i + 1
end
return "%s%s%s",int and "|\interface\icons\icon_int:0|t" or '', arc_brill and "|\interface\icons\icon_arcbrill:0|t" or '',dala_brill and "|\interface\icons\icon_dalabrill:0|t" or ''
and I get | Interfaceiconsicon_arcbrill:0
Also I'd for a Mage I only care if they have one of the 4 types of Intellect buffs, not if they don't have all 4.
Im giving lua texts a go in hope to improve performance on my PB4, but many of my current dogtags are way beyond my level of complexity to even create the DogTag versions myself, much less the lua text ones. So im hoping that someone can help me by looking at my tags (and a small description of how i want them working) and translate them into lua texts. Unfortunately im just to bad at lua to even begin to do it myself, i have tried learning lua, but beyond some very basic editing of existing mods i haven't been able to grasp it on my own.
The first bunch of codes are nestled with raidframe name and don't seem to work right for DC.
I cut out the relevant code for each part (hopefully i got all the little things cut properly).
With PB4's way of managing text positions i should be able to have them all as separate texts and let PB4 handle the spaces and such.
Power: Show mana only, show as X.xk when full and X.x% when not full.
Also when AFK, Dead/Ghost or Offline replace mana display with AFK (AFK:Time), Dead (RIP:Time), Ghost (Run!:Time) and Offline (DC:Time).
Faction and PvP: A for alliance and H for horde, colored based on PvP flagg (about the same as the default names are colored). My faction green for pvp on, blue for pvp off. Opposite faction depends on my pvp state (yellow if im off and they are on, red if both are on and blue if both are off) Currently i only play alliance and tag might reflect that (i haven't made the tag myself so i don't really know)
Extra PvP indicator: Red ! if pvp on and remove the Prepend(" ")
Current
(PvP ? "!":Color("FF0000"):Prepend(" "))
I know im asking a lot, but since i can't seem to learn lua properly myself you guys are my only chance to get all of this working.
Huge thanks with optional hugs for whatever help you guys can give with this!