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 07/09/09, 10:19 PM   #126
Baalzaman
Von Kaiser
 
Undead Mage
 
Blackrock
Having a bit of a issue with a threat display luatext I am working on. I based this text on the existing threat text included in Pitbull4, however I wanted to add colours to the text based on the threat level.

The issue that is occurring is after a period of time in combat in a 25 man raid everything starts lagging, and I've also had a red warning pop-up occur in game complaining that something (it didn't say what) was using a lot of memory.

I'm not totally certain which text i'm using is the guilty party (I use a number, however the rest are basically what have been posted here already and seem to work fine), however I suspect it is this one:

local unit_a,unit_b = ThreatPair(unit)
if unit_a and unit_b then
  local _,_,percent = UnitDetailedThreatSituation(unit_a, unit_b)
  if percent and percent < 50 then
    return "|cFF00FF00%s%%|r",Round(percent,1)
    elseif percent and percent < 85 then
    return "|cFFFFFF00%s%%|r",Round(percent,1)
      elseif percent and percent > 85 then
    return "|cFFFF0000%s%%|r",Round(percent,1)
      end
end
I'm not a programmer! Is it possible for something this small to create a lot of garbage?
 
User is offline.
Reply With Quote
Old 07/10/09, 8:07 AM   #127
Ferretmonger
Glass Joe
 
Ferretmonger's Avatar
 
Blood Elf Hunter
 
Karazhan (EU)
Thought I'd share some of my custom Hunter specific LuaTexts ^_^
Please let me know if they can be optimised in any way.

--Pet Name - Happiness

local happiness = GetPetHappiness()
local happy
if happiness == 1 then
  happy = "D63126"
elseif happiness == 2 then
  happy = "FFDB00"
elseif happiness == 3 then
  happy = "1F295C"
else 
  happy = "FFFFFF"
end
return '|cff%s%s|r',happy,Name(unit)
Will colour your pet's name according to his happiness level. (EDIT: Forgot I got this one off this thread [Post 101] >_< Apologies)



-- Hunter's Mark

Outline()
local i = 1
local mark = true
while true do
  local name,_,icon = UnitAura(unit,i,"HARMFUL")
  if not name then
    break
  elseif name == "Hunter's Mark" then
    mark = false
  end
  i = i + 1
end
if (UnitIsEnemy("player","target")) then
  return "|cffFF6600%s|r",mark and "<<<Hunter's Mark!>>>" or ''
end
Will display "<<<Hunter's Mark!>>>" in bright orange text if the hostile target doesn't have the Hunter's Mark debuff.



The following LuaText displays one's current Attack Power, Crit%, Armor Pen and Hit Rating.
I've got one tiny issue with this one which I'd appreciate some insight on. I just can't seem to find the appropriate API function call to get one's total Attack Power. At the moment, I'm using "UnitRangedAttackPower("player")" but I've discovered that this call only returns one's base AP and not the total buffed AP. If anyone can shed some light on this one I'd appreciate it.

-- Stats

local ap,cr,arp,hr = UnitRangedAttackPower("player"), GetRangedCritChance(), GetCombatRating(25), GetCombatRating(7)
return "|cff94C7FAAP:%.0f \nCr:%.2f%% \nArP:%.0f HR:%.0f|r", ap,cr,arp,hr

Last edited by Ferretmonger : 07/10/09 at 11:02 AM.
 
User is offline.
Reply With Quote
Old 07/12/09, 4:49 PM   #128
Lord Loom
Von Kaiser
 
Lord Loom's Avatar
 
Human Paladin
 
Doomhammer (EU)
I used to remove the player race display from PitBull's Class: Player classes only preset in DogTags, but so far all my attempts with the LuaText version just ruined the tag eventually. How do I keep the race display for NPCs (for pet/NPC types) but disable it for player races?

Everyone always coming to Zathras with problems. Great responsibilities. But Zathras does not mind. Zathras trained in crisis management.
 
User is online.
Reply With Quote
Old 07/12/09, 8:29 PM   #129
Gorsgo
Von Kaiser
 
Undead Rogue
 
Mal'Ganis
return '%s %s', Name(unit), UnitIsPlayer(unit) and '' or SmartRace(unit)
or whatever formatting you like, but that's the general idea.
 
User is offline.
Reply With Quote
Old 07/13/09, 5:28 PM   #130
Ohi
I have evil ovaries.
 
Ohi's Avatar
 
Gnome Mage
 
Thunderlord
I searched the thread and found nothing with crowd control, sap or poly in the post. What I'm looking for is this. I have a current dogtag that I need to be remade into the new LuaText. I am absolutely clueless when it comes to Lua. It took me quite some time to get used to dogtags, and finally got it down.

This is the code I need changed, if anyone can help me out I'd be most thankful. Also, if there is any sort of tutorial or a wiki for the new LuaTexts I'd be happy to read into it myself.

[Outline (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") <= 5) then
    "Resheep NOW!":Yellow
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 5) and (AuraDuration("Polymorph") <= 6) then
    "Breaking in 6!":Fuchsia
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 6) and (AuraDuration("Polymorph") <= 7) then
    "Breaking in 7!":Fuchsia
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 7) and (AuraDuration("Polymorph") <= 8) then
    "Breaking in 8!":Fuchsia
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 8) and (AuraDuration("Polymorph") <= 9) then
    "Breaking in 9!":Fuchsia
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 9) and (AuraDuration("Polymorph") <= 10) then
    "Breaking in 10!":Fuchsia
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 10) and (AuraDuration("Polymorph") <= 11) then
    "Breaking in 11!":Cyan
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 11) and (AuraDuration("Polymorph") <= 12) then
    "Breaking in 12!":Cyan
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 12) and (AuraDuration("Polymorph") <= 13) then
    "Breaking in 13!":Cyan
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 13) and (AuraDuration("Polymorph") <= 14) then
    "Breaking in 14!":Cyan
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 14) and (AuraDuration("Polymorph") <= 15) then
    "Breaking in 15!":Cyan
end) (if HasAura("Polymorph", unit="focus") and (AuraDuration("Polymorph", unit="focus") > 15) and ~Dead then
    "Sheep Safe":Green
end) (if ~HasAura("Polymorph", unit="focus") and InCombat(unit="player") and ~Dead then
    "Broken!":Red
end)]
I know Pitbull 4 allows you to still use dogtags, but I keep getting an error when I try to use this code that I successfully use in PB3.

Edit: There is one more that I could use help with, it's a bit simpler. Just makes names smaller and adds code for status type when they're afk/dead/offline.

[ClassColor(Offline:Truncate(7, nil)) or ClassColor(AFK:Truncate(3, nil)) or ClassColor(DeadType) or ClassColor Name:Truncate(6, nil)]

Last edited by Ohi : 07/13/09 at 5:30 PM. Reason: added additional code
 
User is offline.
Reply With Quote
Old 07/13/09, 7:09 PM   #131
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Ohi: The following code does do the tag, for the most part.
if not Dead(unit) then
 Outline()
 local poly = false
 local i=1
 while true do
  local name,_,_,_,_,_,exp = UnitAura(unit,i,"HARMFUL")
  if not name then
   break
  elseif name == "Polymorph" then
   poly = true
   rem = exp - GetTime()
   break
  end
  i=i+1
 end
 if poly then
  UpdateIn(0.5)
  if rem > 15 then
   return "|cff00ff00Sheep Safe|r"
  elseif rem > 10 then
   return "|cff00ffffBreaking in %d!|r",rem
  elseif rem > 5 then
   return "|cffff00ffBreaking in %d!|r",rem
  else
   return "|cffffff00Resheep NOW!|r"
  end
 else
   return "|cffff0000BROKEN!|r"
 end
end
Attach this to the Focus frame and use the UNIT_AURA event, and the UpdateIn(1) call will take care of the duration change updates.

As for the other tag:
local val = strsub(Name(unit),1,6)
local r,g,b=ClassColor(unit)
if not UnitIsConnected(unit) then
 val="Offline"
elseif UnitIsAFK(unit) then
 val="AFK"
elseif UnitIsDead(unit) then
 val="Dead"
elseif UnitIsGhost(unit) then
 val="Ghost"
end
return "|cff%02x%02x%02x%s|r",r,g,b,val

Last edited by Hotan : 07/15/09 at 7:28 PM.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 07/13/09, 8:42 PM   #132
Ohi
I have evil ovaries.
 
Ohi's Avatar
 
Gnome Mage
 
Thunderlord
@Hotan

Thank you very much.

The top one ONLY goes on the focus frame so it won't be an issue (or consideration on my part). Worked like a charm!
 
User is offline.
Reply With Quote
Old 07/15/09, 7:56 PM   #133
spanko
Von Kaiser
 
Blood Elf Paladin
 
Korgath
I was wondering if someone could help me with name code on my target frame in pitbull4. I switched to luatexts a while ago and this has been bugging me.

Using this code for names (which I think is default):
return '%s %s%s %s',Name(unit),Angle(AFK(unit) or DND(unit))

My target frame looks like this:
http://spanko.shackspace.com/name.jpg

What I want is for the name text to go to a new line under the first when its too long. For example instead of how it looks in the screenshot it would look like this:

Spankolol
<AFK (xx:xx)>

Or on a target with a long name like "Captain Longnamelolol" it would look like this:

Captain
Longnamelolol

I had dogtags setup this way but don't even remember how I did it and I've been trying to for like 45 minutes to do it with luatexts and failed.
 
User is offline.
Reply With Quote
Old 07/20/09, 4:42 PM   #134
BoldOfMazrigos
Banned
 
Tauren Druid
 
Mazrigos (EU)
Perhaps not the place but is there a place where people are showing their Pitbull layouts and provide links/lua text examples?
 
User is offline.
Reply With Quote
Old 07/20/09, 9:43 PM   #135
ctrlfrk
Glass Joe
 
Orc Hunter
 
Firetree
The Pitbull4 wowace forum is fairly active. Not too many full UI posts, but some people are putting up their unitframes. (This is mainly to give visual aid to their questions though, rather than showing off)

You can find that thread here: PitBull 4.0 - WowAce Forums

I think the problem may be that most of the people creating luatexts don't feel very confident with the language, and are reluctant to post their texts except to ask for assistance.

When I get home I will post a few of the texts I'm using, perhaps it will encourage others to do the same. We can turn this thread into the sort of thread you are looking for.


In response to spanko's question:
Initially I didn't think what you were asking was possible, but after reading This I started wondering.
You could try accessing the fontstring object directly, and using API calls that are detailed on wowwiki.

If you check the object page Here it looks as though you could add
font_string:SetWidth(100)
somewhere in your text, (with 100 replaced by whatever width you want the text to start wrapping at is)

Last edited by ctrlfrk : 07/20/09 at 9:58 PM.
 
User is offline.
Reply With Quote
Old 07/21/09, 2:58 PM   #136
spanko
Von Kaiser
 
Blood Elf Paladin
 
Korgath
Thanks ctrlfrk, I got it just how I want it with this:

font_string:SetWidth(10)
font_string:SetHeight(40)
return '%s          %s%s %s',Name(unit),Angle(AFK(unit) or DND(unit))
 
User is offline.
Reply With Quote
Old 07/21/09, 3:56 PM   #137
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
spanko: I could be wrong, but I doubt you actually want that space between "AFK(0:03)" and ">". you have an extra space within your return code. This alleviates that.
font_string:SetWidth(10)
font_string:SetHeight(40)
return '%s          %s%s%s',Name(unit),Angle(AFK(unit) or DND(unit))

Last edited by Hotan : 07/21/09 at 4:02 PM.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 07/21/09, 6:12 PM   #138
spanko
Von Kaiser
 
Blood Elf Paladin
 
Korgath
Good catch, thanks!
 
User is offline.
Reply With Quote
Old 07/24/09, 7:33 PM   #139
jpapciak
Glass Joe
 
Draenei Shaman
 
Cenarion Circle
Is there anyway to use the color gradient used for a unit's health and use it for rage/mana/energy/runic power?
 
User is offline.
Reply With Quote
Old 07/24/09, 10:01 PM   #140
ctrlfrk
Glass Joe
 
Orc Hunter
 
Firetree
Here is a small Luatext to show how far away the unit is from you:

if not libRangeCheck then
     LoadAddOn("LibRangeCheck-2.0")
     libRangeCheck = LibStub("LibRangeCheck-2.0")
end
if libRangeCheck then
     local minRange, maxRange = libRangeCheck:getRange(unit)
     UpdateIn(1.0)
     return "|cff404040%s",  tostring(maxRange or "oor")                      
end
(Edit note: Copied across Shefki's improvement from The WowAce Thread
Some people were having trouble with the order libraries were loaded.)

You may need to install LibRangeCheck for it to work.

Last edited by ctrlfrk : 11/18/09 at 6:08 PM. Reason: Updated to Shefki's code
 
User is offline.
Reply With Quote
Old 07/25/09, 5:01 PM   #141
crags
Glass Joe
 
Undead Mage
 
Sisters of Elune
How would I modify the following to color my mana numbers in red if more than 3500 mana has been used?
local max = Power(unit)
if max > 0 then
local cr,cg,cb = ClassColor(unit)
return "|cff%02x%02x%02x%s|r",cr,cg,cb,Power(unit)
end
I figured I'd just insert something like
If MaxPower(unit) - Power(unit) > 3500 then
return "|cffff0000%s|r%s",Power(unit)
But that doesn't seem to work.

Ok, figured it out:
local max = Power(unit)
local cr,cg,cb = ClassColor(unit)
if MaxPower(unit) - Power(unit) > 3500 then
return "|cffff0000%s|r", Power(unit)
elseif max > 0 then
return "|cff%02x%02x%02x%s|r",cr,cg,cb,Power(unit)
end

Last edited by crags : 07/25/09 at 8:58 PM.
 
User is offline.
Reply With Quote
Old 07/26/09, 10:33 AM   #142
Kilock
Glass Joe
 
Undead Mage
 
Outland (EU)
After reading my way through the thread and even having a dabble at doing it my self (which simply left Pitbull looking at me as if to say "um, no.") I need to swallow my pride and admit I really need help. You may scoff but I'm completely stumped by:

[Status or [if IsMaxHP then
    HP:Hide(MaxHP)
else
    HP:VeryShort " . " PercentHP:Percent
end]]
and

[Status or [if IsMaxHP then
    HP:Hide(MaxHP)
else
    HP:Short
end]]
I know if someone can translate that in to LUA for me I'd have a rough idea, via comparison, on what I'm not picking up on.
 
User is offline.
Reply With Quote
Old 07/27/09, 1:42 AM   #143
ravenndude
Von Kaiser
 
Gnome Mage
 
Anvilmar
Are there arrays in LUA? If so, are they viable (in a CPU / RAM usage sense)?
 
User is offline.
Reply With Quote
Old 07/27/09, 9:47 AM   #144
Gorsgo
Von Kaiser
 
Undead Rogue
 
Mal'Ganis
Originally Posted by ravenndude View Post
Are there arrays in LUA? If so, are they viable (in a CPU / RAM usage sense)?
Yes, Lua has tables. Creating your own tables isn't really viable in a medium like LuaTexts. All code in your tag executes each time the event it's tied to is triggered. That means if you're declaring your table in the tag, a new one will be created every time the tag is executed, which is very bad.

If you're talking about accessing a table that's defined elsewhere (either in the Blizzard FrameXML or in an addon of your own) then that is viable.
 
User is offline.
Reply With Quote
Old 07/27/09, 3:17 PM   #145
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Originally Posted by crags View Post
Ok, figured it out:
local max = Power(unit)
local cr,cg,cb = ClassColor(unit)
if MaxPower(unit) - Power(unit) > 3500 then
return "|cffff0000%s|r", Power(unit)
elseif max > 0 then
return "|cff%02x%02x%02x%s|r",cr,cg,cb,Power(unit)
end
While that works it is terribly inefficient. Use this code instead:
local cur,max= Power(unit),MaxPower(unit)
if max-cur > 3500 then
 return "|cffff0000%s|r", cur
elseif max > 0 then
 local cr,cg,cb = ClassColor(unit)
 return "|cff%02x%02x%02x%s|r",cr,cg,cb,cur
end
Originally Posted by Kilock View Post
After reading my way through the thread and even having a dabble at doing it my self (which simply left Pitbull looking at me as if to say "um, no.") I need to swallow my pride and admit I really need help. You may scoff but I'm completely stumped by:

[Status or [if IsMaxHP then
    HP:Hide(MaxHP)
else
    HP:VeryShort " . " PercentHP:Percent
end]]
and

[Status or [if IsMaxHP then
    HP:Hide(MaxHP)
else
    HP:Short
end]]
I know if someone can translate that in to LUA for me I'd have a rough idea, via comparison, on what I'm not picking up on.
local s=Satus(unit)
if s then
 return s
else
 local cur,max=HP(unit),MaxHP(unit)
 if cur~=max then
  return "%s . %s%%",VeryShort(cur,true),Percent(cur,max)
 end
end
and
local s=Satus(unit)
if s then
 return s
else
 local cur,max=HP(unit),MaxHP(unit)
 if cur~=max then
  return "%s",Short(cur,true)
 end
end

correlation =/= causation
 
User is offline.
Reply With Quote
Old 08/05/09, 6:39 PM   #146
Ferous
Von Kaiser
 
Ferous's Avatar
 
Draenei Paladin
 
Hydraxis
help needed

I have searched this thread and I am still a noob at luatext and coding. I tried to figure out how to add health and name to my raid frames at the same time. I basically would like to get this dogtag and get the luatext for it if at all possible

[if InCombat then
    (-MissingHP):Hide(0):ClassColor
else
    Name:Truncate(5, nil):ClassColor
end]

I am not sure on how to achieve this and any help is greatly appreciated Thank you again.
 
User is offline.
Reply With Quote
Old 08/08/09, 7:34 PM   #147
Stukka
Glass Joe
 
Stukka
Human Warrior
 
Winterhoof
Health Texts

Hello, I am trying to setup my health text and power text to show up as something like this:

10.5k | 14.5k

I have tried all of the default options and screwing around with the code myself. I am an amatuer coder myself so that probably doesn't help. Maybe im just stupid and missed the function i need to use or something who knows. So if some one could please help me i would very much appreciate it.
 
User is offline.
Reply With Quote
Old 08/08/09, 11:43 PM   #148
the SNEEP
Von Kaiser
 
the SNEEP's Avatar
 
Tauren Shaman
 
Mal'Ganis
return "%s | %s",Short(HP(unit),true),Short(Power(unit),true)
Then check these on in Events:
  • UNIT_DISPLAYPOWER
  • UNIT_HEALTH
  • UNIT_FOCUS
  • UNIT_ENERGY
  • UNIT_MANA
  • UNIT_RAGE
  • UNIT_RUNIC_POWER
 
User is offline.
Reply With Quote
Old 08/09/09, 12:30 AM   #149
Stukka
Glass Joe
 
Stukka
Human Warrior
 
Winterhoof
I guess i should have explained it a little better. Thanks for your help though so far. I had something like that working temporary but what i actually want is something like this

10.4k | 10.4k_________________________________18.5k | 18.5k

current and max power_______________________current and max health

Ignore the underscores of course.
I did it before with the old pit bull but I'm having a hell of a time trying to figure it out in the new system.

thanks again sneep
 
User is offline.
Reply With Quote
Old 08/09/09, 1:04 PM   #150
the SNEEP
Von Kaiser
 
the SNEEP's Avatar
 
Tauren Shaman
 
Mal'Ganis
Oh, that's as easy. I'm guessing you want them as separate texts?

Health:
return "%s | %s",Short(HP(unit),true),Short(MaxHP(unit),true)
Power:
if MaxPower(unit) > 0 then
return "%s | %s",Short(Power(unit),true),Short(MaxPower(unit),true)
end
 
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