tzirean: You don't need to define icon from UnitAura() since you don't use it, not that it really hurts much of anything. Also, you should add "HELPFUL" to your UnitAura() call. Also, that SetFormated is going to produce some garbage from what I remember Shefki saying.
Cool, thanks for the info. I was just assuming the code he'd posted worked right, and that all that was necessary was to strip out the stuff he didn't want.
tzirean: You don't need to define icon from UnitAura() since you don't use it, not that it really hurts much of anything. Also, you should add "HELPFUL" to your UnitAura() call. Also, that SetFormated is going to produce some garbage from what I remember Shefki saying. This would have the exact same appearance and be cleaner:
I think the return line on the original is fine. There's no concatenation in that so it's not going to produce garbage. I'd prefer the original simply becuase the resulting text would be empty if there was nothing to display so it would end up producing no string at all.
local i = 1
local renew,mending = false,false
while true do
local name,_,icon = UnitAura(unit,i)
if not name then
break
elseif name == "Renew" then
renew = true
elseif name == "Prayer of Mending" then
mending = true
end
i = i + 1
end
Outline()
return "%s%s",renew and "|cff00C000.|r" or '',mending and "|cff00C5CD.|r" or ''
Sorry I wasn't clear. I'd like to see only the renew / PoM I cast, since now it shows the dot regardless of which priest cast that spell. So the other stuff should stay in the code, since a player can only have one PoW:S on them so it doesn't necessarily matter if it's not mine (especially if I'm not disc). :) My renew: good, Priest2's renew: bad.
And ye my code was snatched from EJ's LuaTexts thread, so it's Shefki's handwriting pretty much I guess? :P
This should do the job of only showing for buffs cast by you. Replace "Myname" with your name and it should work like a charm.
local i = 1
local renew,shield,mending = false,false,false
while true do
local name,_,_,_,_,_,_,caster= UnitAura(unit,i)
if not name then
break
elseif name == "Power Word: Shield" then
shield = true
elseif name == "Weakened Soul" then
shield = true
elseif name == "Renew" and caster == "Myname" then
renew = true
elseif name == "Prayer of Mending" and caster == "Myname" then
mending = true
end
i = i + 1
end
Outline()
return "%s%s%s",shield and "|cffFFFF00.|r" or '',renew and "|cff00C000.|r" or '',mending and "|cff00C5CD.|r" or ''
The reason Shefki didn't use the "HELPFUL" filter before was that he was referencing both buffs and debuffs in the same loop, this filtering will reduce your number of function calls by however many debuffs are on the target.
As for the way the location of the coloring, I changed it back, and I am guessing it has to do with efficiency when the value is false.
EDIT: Got the last one (PvP timer) going on my own. Just had to sew together pieces from two of the default texts. (Name:Hostility-colored and PvPTimer:Standard) :D
-- PvP Timer
if unit == "player" then
local r,g,b = HostileColor(unit)
local pvp = PVPDuration()
if pvp then
return '|cff%02x%02x%02x%s|r',r,g,b,FormatDuration(pvp)
end
end
# Class Info
[Level: DifficultyColor] [Class:Classcolor]
[Guild:Angle]
local dr,dg,db=DifficultyColor(unit)
local cr,cg,cb=ClassColor(unit)
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s%s%s"
,dr,dg,db,Level(unit),cr,cg,cb,Class(unit),Angle(GetGuildInfo(unit))
OR
local dr,dg,db=DifficultyColor(unit)
if UnitIsPlayer(unit) then
local cr,cg,cb=ClassColor(unit)
else
local cr,cg,cb=HostileColor(unit)
end
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s%s%s"
,dr,dg,db,Level(unit),cr,cg,cb,Class(unit),Angle(GetGuildInfo(unit))
# Class Info
[Level: DifficultyColor] [SmartRace:ClassColor]
local dr,dg,db=DifficultyColor(unit)
local cr,cg,cb=ClassColor(unit)
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit),cr,cg,cb,Race(unit)
OR
local dr,dg,db=DifficultyColor(unit)
if UnitIsPlayer(unit) then
local cr,cg,cb=ClassColor(unit)
else
local cr,cg,cb=HostileColor(unit)
end
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit),cr,cg,cb,Race(unit)
# Show health when not at full, name when full
[IsMaxHP ? Name ! FractionalHP]
local cur,max=HP(unit),MaxHP(unit)
if cur==max then
return Name(unit)
else
return "%s/%s",cur,max
end
local cur,max=Power(unit),MaxPower(unit)
local per=Percent(cur,max)
if per<20 then
return "|cffff0000%d%%|r,per
elseif per<50 then
return "|cffffff00%d%%|r,per
else
return "|cffffffff%d%%|r,per
end
#1 If possible could someone tell me the lua code I need for my health text. I want it to appear as absolute (e.g. 20000/20000) which is fine as there is an option for that. But also, when the value is zero (ie. they are dead) I want it to display "DEAD" in this place. And finally, if a resurrection spell is currently being cast on them, I want it to display "Player Resurrecting" instead of "DEAD" ('Player' being the name of the person casting resurrection). I need it to be work for all resurrection spells (so Resurrection, Ancestral Spirit, Revive, Redemption, and most importantly, the druid battle ress Rebirth).
#2 I'd like to know if it is possible to make Disease, Curse, Magic, Poison, and also my current target, to have a different colored border (similar to how Aggro coloring works), as opposed to a highlight. If it is, how do I do it (I can't seem to find an option). If not, is it something in the works, or unlikely to be added in the future?
Tippii: The resurrection part isn't really possible. It would require a res lib of sorts.
Yup it's not possible to know the target of someone elses spell without some code on their end communicating it to you until the spell is finished casting. Even then players that released and are being resurrected by someone casting on their corpse require a degree of tooltip scanning to identify who is the target of the spell.
I've thought about using LibResComm but haven't decided if it's useful enough to add another dependency.
Ah okay, that's a shame but I appreciate writing the other bit of the code for me, thank you :) Would it be worth me putting a ticket in to record my request/see if enough other people are interested in the feature to make it worthwhile?
Lastly, any info on "#2 I'd like to know if it is possible to make Disease, Curse, Magic, Poison, and also my current target, to have a different colored border (similar to how Aggro coloring works), as opposed to a highlight. If it is, how do I do it (I can't seem to find an option). If not, is it something in the works, or unlikely to be added in the future?" would be great :)
So, I've used some dog tags before and I was wondering if anyone can tell me how to do the following now that dog tags have been removed and you have to use lua text instead.
on my player frame, I would like a large dot (".") for each stack of maelstrom weapon buff my shaman has.
I think the dog tag would of been:
[ outline (if (Class(unit="player") = "Shaman") and (TalentTree(unit="player") = "Enhancement") and HasAura("Maelstrom Weapon") then
".":Repeat(NumAura("Maelstrom Weapon"))
end)]
So, I've used some dog tags before and I was wondering if anyone can tell me how to do the following now that dog tags have been removed and you have to use lua text instead.
on my player frame, I would like a large dot (".") for each stack of maelstrom weapon buff my shaman has.
This should do what you want. There's really not a great way to do talent tree checking and I don't see the point in checking it. If the buff isn't there then there just won't be any periods.
local _,class = UnitClass(unit)
if class == "SHAMAN" then
local _,_,_,count = UnitAura(unit,"Maelstrom Weapon",nil,"HELPFUL")
if count then
Outline()
return strrep(".",count)
end
end
if UnitClass(unit) == "Shaman" then
local _, mh_time_left = GetWeaponEnchantInfo()
if not mh_time_left or mh_time_left <= 300 then
local actTalent = GetActiveTalentGroup(nil, nil)
if actTalent==1 then return "|TInterface\\Icons\\Spell_Shaman_Earthlivingweapon:30|t" end
if actTalent==2 then return "|TInterface\\Icons\\spell_fire_flametounge:30|t" end
end
if not tt then
tt = CreateFrame("GameTooltip")
tt:SetOwner(UIParent, "ANCHOR_NONE")
left = {}
local g = tt:CreateFontString()
g:SetFontObject(GameFontNormal)
for i = 1, 30 do
local f = tt:CreateFontString()
f:SetFontObject(GameFontNormal)
tt:AddFontStrings(f, g)
left[i] = f
end
end
tt:ClearLines()
tt:SetInventoryItem("player",GetInventorySlotInfo("MainHandSlot"))
for i = 1, 30 do
local text = left[i]:GetText()
if text then
local buff_name = text:match("^(.+) %(%d+ [^$)]+%)$")
if buff_name then
local buff_name_no_rank = buff_name:match("^(.*) %d+$")
local actTalent = GetActiveTalentGroup(nil, nil)
if actTalent==1 and buff_name_no_rank ~= "Earthliving" then return "|TInterface\\Icons\\Spell_Shaman_Earthlivingweapon:30|t" end
if actTalent==2 and buff_name_no_rank ~= "Flametongue" then return "|TInterface\\Icons\\spell_fire_flametounge:30|t" end
end
end
end
end
I've got this tag at my player frame for indicating whether I have to switch my weapon buff (TalentSpecc1: Restoration -> Earthliving, TalentSpecc2: Elemental -> Flametongue)
Everything works without problems aside from the situation when I switch my talents. I have to cast the weapon buff 2 times to make the icon update itself correctly. I think it's the missing event when the dualspec feature is used. The only event I'm using for this is UNIT_INVENTORY_CHANGED set to only the unit (arg1) which is affected.
Hey everyone, I pretty new to Pitbulls and I had just finished configuring it to how I like it. I made a blankframe on top to put Class and Player Name inside of it. Now I wanted to make it so in the Center it shows the Threat Percentage. I set it up to do that however I get this error.
[string
" PitBull4_LuaTexts:Normal:Lua:Threat"]:3:
Usage: Unit DetailedThreatSituation( "unit" [, "mob"])
Now the unit frame doesn't even bother showing the threat percentage and this message consistently popped up during a Hodir fight each time I assume the threat changes, I'd really like some help on fixing this, Thanks in advanced.
Hey everyone, I pretty new to Pitbulls and I had just finished configuring it to how I like it. I made a blankframe on top to put Class and Player Name inside of it. Now I wanted to make it so in the Center it shows the Threat Percentage. I set it up to do that however I get this error.
[string
" PitBull4_LuaTexts:Normal:Lua:Threat"]:3:
Usage: Unit DetailedThreatSituation( "unit" [, "mob"])
Now the unit frame doesn't even bother showing the threat percentage and this message consistently popped up during a Hodir fight each time I assume the threat changes, I'd really like some help on fixing this, Thanks in advanced.
Are you using one of the pre-written Threat texts i.e. the ones that are in the dropdown "Threat: Percent" and so on... If so which one are you using.
Or are you using something custom that you made yourself?
Are you using one of the pre-written Threat texts i.e. the ones that are in the dropdown "Threat: Percent" and so on... If so which one are you using.
Or are you using something custom that you made yourself?
I'm using the Pre-Written text since I don't know much about coding to make a custom job, all I had done was switch the location from "Threat Bar" to Blank Space.
Cool, thanks for the info. I was just assuming the code he'd posted worked right, and that all that was necessary was to strip out the stuff he didn't want.
I think the return line on the original is fine. There's no concatenation in that so it's not going to produce garbage. I'd prefer the original simply becuase the resulting text would be empty if there was nothing to display so it would end up producing no string at all.
Sorry I wasn't clear. I'd like to see only the renew / PoM I cast, since now it shows the dot regardless of which priest cast that spell. So the other stuff should stay in the code, since a player can only have one PoW:S on them so it doesn't necessarily matter if it's not mine (especially if I'm not disc). :) My renew: good, Priest2's renew: bad.
And ye my code was snatched from EJ's LuaTexts thread, so it's Shefki's handwriting pretty much I guess? :P
The reason Shefki didn't use the "HELPFUL" filter before was that he was referencing both buffs and debuffs in the same loop, this filtering will reduce your number of function calls by however many debuffs are on the target.
As for the way the location of the coloring, I changed it back, and I am guessing it has to do with efficiency when the value is false.
# Class Info
[Level: DifficultyColor] [Class:Classcolor]
[Guild:Angle]
# Class Info
[Level: DifficultyColor] [SmartRace:ClassColor]
# Show health when not at full, name when full
[IsMaxHP ? Name ! FractionalHP]
# Color MP based on percent, percent MP
[(~IsMaxMP ? ((MP < MaxMP * 0.2):Red | (MP < MaxMP * 0.5):Yellow | (MP > MaxMP * 0.5):White) " | ") PercentMP:Round:Percent]
# PvP timer
[PvPDuration:FormatDuration:HostileColor]
EDIT: Got the last one (PvP timer) going on my own. Just had to sew together pieces from two of the default texts. (Name:Hostility-colored and PvPTimer:Standard) :D
OR
#1 If possible could someone tell me the lua code I need for my health text. I want it to appear as absolute (e.g. 20000/20000) which is fine as there is an option for that. But also, when the value is zero (ie. they are dead) I want it to display "DEAD" in this place. And finally, if a resurrection spell is currently being cast on them, I want it to display "Player Resurrecting" instead of "DEAD" ('Player' being the name of the person casting resurrection). I need it to be work for all resurrection spells (so Resurrection, Ancestral Spirit, Revive, Redemption, and most importantly, the druid battle ress Rebirth).
#2 I'd like to know if it is possible to make Disease, Curse, Magic, Poison, and also my current target, to have a different colored border (similar to how Aggro coloring works), as opposed to a highlight. If it is, how do I do it (I can't seem to find an option). If not, is it something in the works, or unlikely to be added in the future?
Thanks :)
Yup it's not possible to know the target of someone elses spell without some code on their end communicating it to you until the spell is finished casting. Even then players that released and are being resurrected by someone casting on their corpse require a degree of tooltip scanning to identify who is the target of the spell.
I've thought about using LibResComm but haven't decided if it's useful enough to add another dependency.
Lastly, any info on "#2 I'd like to know if it is possible to make Disease, Curse, Magic, Poison, and also my current target, to have a different colored border (similar to how Aggro coloring works), as opposed to a highlight. If it is, how do I do it (I can't seem to find an option). If not, is it something in the works, or unlikely to be added in the future?" would be great :)
on my player frame, I would like a large dot (".") for each stack of maelstrom weapon buff my shaman has.
I think the dog tag would of been:
Thanks.
This should do what you want. There's really not a great way to do talent tree checking and I don't see the point in checking it. If the buff isn't there then there just won't be any periods.
With the event UNIT_AURA checked.
I've got this tag at my player frame for indicating whether I have to switch my weapon buff (TalentSpecc1: Restoration -> Earthliving, TalentSpecc2: Elemental -> Flametongue)
Everything works without problems aside from the situation when I switch my talents. I have to cast the weapon buff 2 times to make the icon update itself correctly. I think it's the missing event when the dualspec feature is used. The only event I'm using for this is UNIT_INVENTORY_CHANGED set to only the unit (arg1) which is affected.
[string
" PitBull4_LuaTexts:Normal:Lua:Threat"]:3:
Usage: Unit DetailedThreatSituation( "unit" [, "mob"])
Now the unit frame doesn't even bother showing the threat percentage and this message consistently popped up during a Hodir fight each time I assume the threat changes, I'd really like some help on fixing this, Thanks in advanced.
Are you using one of the pre-written Threat texts i.e. the ones that are in the dropdown "Threat: Percent" and so on... If so which one are you using.
Or are you using something custom that you made yourself?
I'm using the Pre-Written text since I don't know much about coding to make a custom job, all I had done was switch the location from "Threat Bar" to Blank Space.
surround your current tag with this:
WORKED. thanks alot
local r,g,b = HostileColor(unit)
Is that what I should use, and where in the LUA Text code should i put it?