WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Pitbull & Lua - Weakened Soul (https://www.wowinterface.com/forums/showthread.php?t=39627)

Talisia 04-14-11 07:16 AM

Pitbull & Lua - Weakened Soul
 
Hello =)

I have a peice of lua code for my pitbull frames which shows me as a healer my important buffs etc. I am absolutely rubbish with Lua and picked the code up somewhere on the web (Ty!). I have been trying to incorporate the Weakened Soul Debuff but I just can not get it to work =(

I have hit a dead end and for the life of me can not work it out and I was hoping some nice person browsing this forum may be able to shed some light on it for me and put me out of my misery! Being a disc priest I have to see this debuff! ;)

This is my code:

local text = ""
local count

if UnitAura(unit, "Renew") ~= nil then
text = text .. format("|cffffff00%s|r", " R ")
end

if UnitAura(unit, "Fear Ward") ~= nil then
text = text .. format("|cff00ff00%s|r","FW ")
end

if UnitAura(unit, "Prayer of Mending") ~= nil then
text = text .. format("%s","PoM ")
end

if UnitAura(unit, "Power Word: Shield") ~= nil then
text = text .. format("|cffffff00%s|r","PW:S ")
end

if UnitAura(unit, "Pain Suppression") ~= nil then
text = text .. format("|cff00ff00%s|r","PS ")
end

if UnitAura(unit, "Soulstone Resurrection") ~= nil then
text = text .. format("|cff00ff00%s|r","SS ")
end

if UnitAura(unit, "Beacon of Light") ~= nil then
text = text .. format("|cff00ff00%s|r","BoL ")
end

if UnitAura(unit, "Hand of Protection") ~= nil then
text = text .. format("|cff00ff00%s|r","HoP ")
end

if UnitAura(unit, "Lifebloom ") ~= nil then
_,_,_,count = UnitAura(unit, "Lifebloom")
text = text .. format("|cffffff00%s|r[%d]","LB",count)
end

return text

Any help offered I sincerely appreciate! =)

Terranell 04-14-11 09:34 AM

I've got a similar set up with lua texts though I really need to tidy it up. I found that Weakened Soul had to have UnitAura(unit,i,"HARMFUL") to work, without the "HARMFUL" I couldn't get it to show. But that's with a disclaimer that I only dabble at the edges of lua, tweaking my local copies of addons to suit me, and don't know that much about it.

Mischback 04-14-11 09:53 AM

"Weakened Soul" is actually a debuff, so Terranell is absolutely right, you'll have to add the "HARMFUL"-flag, because without it, "HELPFUL" is implicitly set.

Talisia 04-14-11 11:25 AM

Hiya and ty for the replies! =)

Regarding 'Harmful' that is the information I found when googling, but no matter how I put it in (copying pieces of code here and there) it just would never work =(

Mostly what I had was something like this:

if UnitAura(unit, "Weakened Soul") ~= nil "Harmful" then
text = text .. format("|cffffff00%s|r", "WS")
end

Again, I really have no idea what im doing when it comes to Lua I just love to tinker with it ;)

Terranell 04-14-11 11:45 AM

Have you tried

if UnitAura(unit, "Weakened Soul","HARMFUL") ~= nil then
text = text .. format("|cffffff00%s|r", "WS")
end

As a side note, can anyone explain what the benefits are to ~= nil over == true in terms of checking auras?

Mischback 04-14-11 12:07 PM

It should work with

lua Code:
  1. if ( UnitAura(unit, "Weakened Soul","HARMFUL") ) then
  2.      text = text .. format("|cffffff00%s|r", "WS")
  3. end

Quote:

Originally Posted by Terranell (Post 234534)
As a side note, can anyone explain what the benefits are to ~= nil over == true in terms of checking auras?

UnitAura does not return a boolean - true/false - value, but

Quote:

name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId
= UnitAura("unit", index or "name"[, "rank"[, "filter"]])
So you can not check for true, because it doesn't return true in its first return value (it's the name).
But a name - a string to be specific - is something different than "nil", so you can check if it is not nil.

Terranell 04-14-11 03:48 PM

ahh thanks :D

Talisia 04-14-11 11:07 PM

Still not working, ty both for your help! I copied and pasted both of your codes but nope nothing =( I just cant see what im doing wrong, everything else shows up fine, its just the Weakened Soul.

I really want to find an answer to this as mentioned im a disc priest so its just not something I can do without! ;)

Ty again :)


All times are GMT -6. The time now is 10:11 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI