Go Back   WowAce Forums > General > Lua Code Discussion
Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding].

Reply
 
Thread Tools
Old 2 Weeks Ago   #1
dawl
Newbie
 
Join Date: Sep 2008
Posts: 7
Default Checking for debuffs types

Hi.

I'm having some trouble using UnitAura checking for debuff types. Here's my code:

Code:
if event == "UNIT_AURA" then
    local type = UnitDebuff(unit, i)
    local str

    if type == "Magic" then
        str = "MAGIC"
    end

    self.name:SetText(str)
end
I'm at a loss here, does anyone see what's wrong?

Thanks.
dawl is offline   Reply With Quote
Old 2 Weeks Ago   #2
Torhal
Moderator
 
Torhal's Avatar
 
Join Date: Feb 2008
Posts: 1,431
Send a message via ICQ to Torhal
Default Re: Checking for debuffs types

If they type isn't magic, then your SetText uses nil.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of Revelation, Volumizer, and many other AddOns.
Torhal is offline   Reply With Quote
Old 2 Weeks Ago   #3
Graveeater
Junior Member
 
Join Date: Aug 2005
Posts: 63
Default Re: Checking for debuffs types

Check http://wowprogramming.com/docs/api/UnitDebuff, the first return value is the debuffs name, which probably is not "Magic", and probably isn't either what you mean with type. I suppose you want the 5th return value?
Graveeater is offline   Reply With Quote
Old 2 Weeks Ago   #4
Adirelle
Amazing Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Location: Lyon, France
Posts: 1,639
Default Re: Checking for debuffs types

Code:
local type = UnitDebuff(unit, i)
Where does "i" come from ? Shouldn't the code examine every debuffs ?
__________________
Author of Squire, Inline Aura and several other addons.

If you have a problem and you think the solution involves using a regular expression, then you have two problems.
Adirelle is offline   Reply With Quote
Old 2 Weeks Ago   #5
egingell
Hero Member
 
egingell's Avatar
 
Join Date: May 2006
Location: Cenarion Circle
Posts: 805
Send a message via AIM to egingell Send a message via MSN to egingell
Default Re: Checking for debuffs types

Quote:
Originally Posted by Adirelle View Post
Code:
local type = UnitDebuff(unit, i)
Where does "i" come from ? Shouldn't the code examine every debuffs ?
/sigh
It's probably not his full code.

Anywho, @OP:
Quote:
http://www.wowwiki.com/API_UnitDebuff
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitDebuff(unitID, index or name [, removable]);
__________________
Bruce Lee killed Chuck Norris!
Don't call me a nerd. That is offensive to my people.
My Characters (yes, I have a guild with only me in it).
egingell is offline   Reply With Quote
Old 2 Weeks Ago   #6
dawl
Newbie
 
Join Date: Sep 2008
Posts: 7
Default Re: Checking for debuffs types

I figured it out, thanks for your help : )
dawl is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 08:55 AM.