Plus Heal|Site Info
Page
of 10

LUA Text Thread (for Pitbull 4)

95 replies
2 posts
Untagged users
Hi guys,

I'm trying to make a debuff filter for my pitbull healing frames. My lua skills are poor so I modified the code from Oleander on the first page of this thread:

shieldFilter = shieldFilter or { ["Deep Freeze"]=1, ["Hammer of Justice"]=1, ["Fist of Justice"]=1, ["Repentance"]=1, ["Silence"]=1, ["Fear"]=1, ["Psychic Scream"]=1, ["Psychic Terror"]=1, ["Howl of Terror"]=1, ["Polymorph"]=1, ["Strangulate"]=1, ["Ring of Frost"]=1, ["Frostjaw"]=1, ["Dragon's Breath"]=1, ["Blinding Light"]=1, ["Freezing Trap"]=1, ["Static Charge"]=1, ["Silencing Shot"]=1, ["Shadowfury"]=1, ["Mortal Coil"]=1, ["Spell Lock"]=1, ["Counterspell"]=1, ["Silenced - Improved Counterspell"]=1, ["Remorseless Winter"]=1, ["Paralysis"]=1, ["Hex"]=1, ["Devouring Plague"]=1, ["Combustion"]=1 } local text=""; for i=1,10 do local n,_,icon,_,_,_,_,_,_=UnitDebuff(unit,i); if shieldFilter[n] then text = text .. "|T" .. icon .. ":31|t" ; end end return text


It works, but I want to display Hex (curse) only if I'm playing on my Shaman, and Devouring Plague (disease) when I'm playing on my Paladin. I basically want it to check if I can dispel it.

Another small problem is that the icons are now placed under the name text:
tlxgBa4.jpg
How can I get the icon placed on top of the name text?
Posted Feb 7, 13
Hey guys, I have no idea what I'm doing with LUA scripting but I was wondering If I could get some help for a simple script. I was wondering how I could get pit bull to display health in a percentage, and disappear if it's 100%. If anyone could help me out with that, I would really appreciate it, thanks :sick:

I've been trying on my own with the VERY, very, very little I know, but I just seem to keep messing it up because everything vanishes lol.

edit:

I was looking through the posts and found this one

local cur,max = HP(unit), MaxHP(unit); local diff = max-cur; local pct = cur / max; local color = 0; if ( pct <= 0.50 ) then color = 0xFF0030 + floor(pct*255)*512; else color = 0x10FF30 + floor((1-pct)*235)*131072; end if (diff > 0) then return "|cff%x-%s", color, Short(diff,true); end


Is there anyway someone could make this display in a percent rather than short ?
Posted Feb 7, 13
394 posts
Untagged users
Naso wrote:
Is there anyway someone could make this display in a percent rather than short ?
The first thing to understand is what the "|cff%x-%s" string is doing. The second thing to understand is where the short form of the difference is coming from.

The string is what's known as a "format string". % indicates a substitution is to occur, and there's a bunch of rules about how that works. For now, just see that there's two, a %x and a %s. color is being fed to %x and Short(diff,true) is being fed to %s.

The second is the Short(diff, true) is a function which takes a number and a boolean and returns a string. But you don't want this output, you want a percentage.

As luck would have it the percentage is already computed in this code, and stored in the variable pct. However, that percentage goes from 0 to 1, not 0 to 100 which is what I suspect you want.

So change that return line to

return "|cff%x%0.1f", color, pct*100
Posted Feb 7, 13
394 posts
Untagged users
zahia wrote:
It works, but I want to display Hex (curse) only if I'm playing on my Shaman, and Devouring Plague (disease) when I'm playing on my Paladin. I basically want it to check if I can dispel it.

You want an icon displayed if the debuff is dispellable, and no icon if it's not dispellable? You're better off using Pitbull's aura module for that, rather than doing it with a text. If you did it with a text, you can do better than an explicit list like that as UnitAura reports if the aura is dispellable.
Posted Feb 7, 13
Oleander wrote:
Naso wrote:
Is there anyway someone could make this display in a percent rather than short ?
The first thing to understand is what the "|cff%x-%s" string is doing. The second thing to understand is where the short form of the difference is coming from.

Thanks a lot for explaining that for me, appreciate it.
Posted Feb 7, 13
2 posts
Untagged users
Ah thanks, It took me a while to figure out the aura module but it's working now.
Only aligning the debuff in the middle of my raid frames are giving me some problems.Right now I'm using 1 debuff maximum, centered in the raid frames using the horizontal/vertical offset sliders. But it becomes a problem when I want to display more then 1 debuff. It wont be aligned to the center. :(
Posted Feb 8, 13
Page
of 10
Announcement of