Elitist Jerks
Register
Blogs
Urban Rivals
Forums
New Posts


Go Back   Elitist Jerks > Public Discussion > User Interface and AddOns
Elitist Jerks Login

gamerDNA Login

Welcome to Elitist Jerks
We're testing some new features on the site regarding OpenID registration and coordination with gamerDNA. If you experience any issues with registering an account, please take the time to fill out a report and send it to this e-mail address. We would appreciate any assistance you could provide in making sure everything is functioning as intended. Thanks!

If this is your first visit, please be sure to check out the FAQ and the forum rules. Users must register to post and new registrations are subject to a one day "mute" period to get acquainted with the community.

Reply
 
LinkBack (18) Thread Tools
Old 06/14/09, 7:18 PM   12 links from elsewhere to this Post. Click to view. #1
Ajuga
Piston Honda
 
Ajuga's Avatar
 
Tauren Hunter
 
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.
 
User is offline.
Reply With Quote
Old 06/14/09, 11:05 PM   #2
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
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.
 
User is offline.
Reply With Quote
Old 06/15/09, 4:19 AM   #3
Dankz
Piston Honda
 
Dankz's Avatar
 
Undead Mage
 
Caelestrasz
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 5:58 AM.
 
User is offline.
Reply With Quote
Old 06/15/09, 5:36 AM   #4
Led ++
Piston Honda
 
Led ++'s Avatar
 
Blood Elf Paladin
 
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?

http://thepiratebootybay.com/ THE best Addon site out there!
 
User is offline.
Reply With Quote
Old 06/15/09, 3:04 PM   #5
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
Originally Posted by Dankz View 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.
 
User is offline.
Reply With Quote
Old 06/15/09, 3:05 PM   #6
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
Originally Posted by Led ++ View Post
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.
 
User is offline.
Reply With Quote
Old 06/15/09, 4:25 PM   #7
Katae
Glass Joe
 
Draenei Priest
 
Anvilmar
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 4:34 PM.
 
User is offline.
Reply With Quote
Old 06/15/09, 4:34 PM   #8
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Edit; He fixed it himeslf
 
User is offline.
Reply With Quote
Old 06/15/09, 4:50 PM   #9
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
Originally Posted by Katae View Post
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.
 
User is offline.
Reply With Quote
Old 06/15/09, 6:18 PM   #10
Wodahs
Don Flamenco
 
Human Rogue
 
Lightbringer
[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 6:20 PM. Reason: clarity
 
User is offline.
Reply With Quote
Old 06/15/09, 7:16 PM   #11
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
Originally Posted by Wodahs View Post
[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)
 
User is offline.
Reply With Quote
Old 06/15/09, 8:10 PM   #12
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
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
 
User is offline.
Reply With Quote
Old 06/16/09, 6:55 AM   #13
 Kalroth
I didn't do it
 
Kalroth's Avatar
 
Orc Warrior
 
Stormrage (EU)
Originally Posted by Hotan View Post
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 "".
 
User is offline.
Reply With Quote
Old 06/16/09, 8:07 AM   #14
Garaddon
Glass Joe
 
Garaddon's Avatar
 
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
 
User is offline.
Reply With Quote
Old 06/16/09, 1:22 PM   #15
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
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 1:28 PM.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 06/16/09, 1:46 PM   #16
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
Originally Posted by Hotan View Post
btw: what exactly does |r mean?
Stops the custom color that was started by a previous |cff escape code.
 
User is offline.
Reply With Quote
Old 06/16/09, 3:03 PM   #17
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
So my code is still not working :/

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>:

  ---
edit: "Lua:Debuff Check" is the name of the Text

Last edited by Hotan : 06/16/09 at 4:12 PM.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 06/16/09, 6:45 PM   #18
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
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
 
User is offline.
Reply With Quote
Old 06/16/09, 7:36 PM   #19
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
thanks Shefki,

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)

Last edited by Hotan : 06/16/09 at 7:51 PM.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 06/16/09, 7:55 PM   #20
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
Originally Posted by Hotan View Post
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'

There's a dozen different ways to do this.
 
User is offline.
Reply With Quote
Old 06/16/09, 9:56 PM   #21
rakkarage
Glass Joe
 
Troll Warrior
 
Destromath
return '%s %s%s%s',Name(unit),Angle(AFK(unit) or DND(unit))

so that is the default name text...

what are the two extra %s for?
 
User is offline.
Reply With Quote
Old 06/16/09, 10:05 PM   #22
ctrlfrk
Glass Joe
 
Orc Hunter
 
Firetree
The Angle() function returns 3 strings, so you need three %s.
From the project page:
Angle(value)
Returns three values '<',value,'>' if value is not nil or ''. If value is '' or nil then it returns three empty strings.
It's really just a shorthand to hide the angle brackets if there is no value to display.
 
User is offline.
Reply With Quote
Old 06/17/09, 5:15 AM   #23
Shefki
Von Kaiser
 
Night Elf Druid
 
Garrosh
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.
 
User is offline.
Reply With Quote
Old 06/17/09, 6:30 AM   #24
Dankz
Piston Honda
 
Dankz's Avatar
 
Undead Mage
 
Caelestrasz
Originally Posted by Shefki View Post
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.
 
User is offline.
Reply With Quote
Old 06/17/09, 11:43 AM   #25
Zeelian
Glass Joe
 
Zeelian's Avatar
 
Night Elf Priest
 
Azjol-Nerub (EU)
Okay, here goes. (Warning Huge post)

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.

Original tag:
[(IsLeader ? "!":Color("00FF00")) (IsMasterLooter ? "!":Color("FFFF33")) Name:Truncate(9, nil):Prepend(" ") (~IsMaxLevel ? "*":Color("FFFFFF"):Prepend(" ")) ShortDruidForm:Angle:Color("FFAAAA"):Prepend(" ") "    " (~Status ? IsMana ? IsMaxMP ? MaxMP:Short ! PercentMP:Percent) (DeadType ? DeadType = "Ghost" ? "Run! " ! "Rip ") DeadDuration:FormatDuration:Paren (Offline ? "DC ") OfflineDuration:FormatDuration:Paren]
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).

Current
(~Status ? IsMana ? IsMaxMP ? MaxMP:Short ! PercentMP:Percent) (DeadType ? DeadType = "Ghost" ? "Run! " ! "Rip ") DeadDuration:FormatDuration:Paren (Offline ? "DC ") OfflineDuration:FormatDuration:Paren]

ML/RL: Yellow ! for ML, Green ! for Leader

Current
(IsLeader ? "!":Color("00FF00")) (IsMasterLooter ? "!":Color("FFFF33"))

Level indicator: A white * if the person is not max level

Current
(~IsMaxLevel ? "*":Color("FFFFFF"))
Forms: 2 letters indicating druid form and 1 letter ( S ) indicating shadowform (current has druid form only)

Current
ShortDruidForm:Angle:Color("FFAAAA")
Name: Player name with 9 letters (this one probably isn't very hard thou, i just can't seem to think straight today)

Current
Name:Truncate(9, nil)

Next bunch is the target info tag (same as above about being nestled and wanting to make them separate texts)

Orignal tag:
[(~IsPlayerOrPet ? CreatureType:Hide("Unknown", "Not specified"):Append(" ")) (~IsPet ? Level:Hide("??"):DifficultyColor:Append(" ") ! Level) " " (~IsPlayerOrPet ? Classification:Contains("Rare") ? "R":Gray) (~IsPlayerOrPet ? Classification:Contains("Elite") ? "E":Yellow) (~IsPlayerOrPet ? Classification:Contains("Boss") ? "B":Red) Faction:IsIn("Alliance", "Horde"):Truncate(1, ellipses=false):Prepend([~IsFriend ? "player":PvP] ? [PvP ? Red ! Yellow] ! [PvP ? Green ! Blue]) " " (IsPet ? Guild) (IsPlayer ? Class:ClassColor:Prepend(" "))]
Creature type: basicly the beast/mechanical and so on and hiding unknown and not specified

Current
(~IsPlayerOrPet ? CreatureType:Hide("Unknown", "Not specified")

Level: Difficulty colored level (take out the Append(" ") since it won't be needed when each part is a separate text)

Current
(~IsPet ? Level:Hide("??"):DifficultyColor:Append(" ") ! Level)

Rare, Elite, Boss indicator: Nothing special here.

Current
(~IsPlayerOrPet ? Classification:Contains("Rare") ? "R":Gray) (~IsPlayerOrPet ? Classification:Contains("Elite") ? "E":Yellow) (~IsPlayerOrPet ? Classification:Contains("Boss") ? "B":Red)

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)

Current
Faction:IsIn("Alliance", "Horde"):Truncate(1, ellipses=false):Prepend([~IsFriend ? "player":PvP] ? [PvP ? Red ! Yellow] ! [PvP ? Green ! Blue]) " " (IsPet ? Guild) (IsPlayer ? Class:ClassColor:Prepend(" "))

And a few for target name tag aswell.


Current
[Name:ClassColor " " (IsPlayer ? Guild:Truncate(34, nil):Bracket:Color("eeaaee")) " " (HasAura("Unstable Affliction") ? "UA":Color("Red"):Angle) (HasAura("Shadowform") ? "S":Color("dda0dd"):Angle) ShortDruidForm:Color("dda0dd"):Angle (PvP ? "!":Color("FF0000"):Prepend(" "))]
Guild: Basic guild name

Current
(IsPlayer ? Guild:Truncate(34, nil):Bracket:Color("eeaaee"))
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!
 
User is offline.
Reply With Quote
Reply

Go Back   Elitist Jerks > Public Discussion > User Interface and AddOns

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
The DogTags 3.0 Thread Trouble User Interface and AddOns 622 10/06/09 3:51 PM
[DogTags] - Share yours! Fulnir User Interface and AddOns 164 03/30/08 2:30 AM