Thread Tools Display Modes
04-28-08, 07:45 PM   #1
halpmeh
A Murloc Raider
Join Date: Feb 2008
Posts: 6
Need help on function for new combat log stuffs..

Code:
function Innervate_OnEvent(e)
	if (e == "COMBAT_LOG_EVENT_UNFILTERED") then
		local event,destName = arg2,arg7
		if(event == "SPELL_AURA_APPLIED") then
			local spellID = arg10
			local isEnemy = (bit.band(arg5, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE)
			
			spell,_,_ = GetSpellInfo(spellID)
			if (spell == "Innervate" and isEnemy) then
				ZoneTextString:SetText("INNERVATE!!");
				ZoneTextFrame.startTime = GetTime()
				ZoneTextString:SetTextColor(0, 1, 0);
				PVPInfoTextString:SetText("");
				ZoneTextFrame:Show()
				
			end
		end
	end
end
Alright, the code is fairly straightforward, I'm trying to set it up to announce when "Innervate" ( http://www.wowhead.com/?spell=29166 ) is gained on an enemy.
It doesn't seem to be working and I believe I've narrowed down my problem to
Code:
if(event == "SPELL_AURA_APPLIED") then
			local spellID = arg10
but it could be wrong.

Ideally, I would like to just search for the spell using spellID's instead of SpellName but every time i try it fails. Can anyone shine some light on this for me pretty please? I'm not sure where I'm messing up but I know I am because it's not working and it's really buggin the heck outta me Thanks !
  Reply With Quote
04-28-08, 08:20 PM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
have you tried:

Code:
spell,_,_ = GetSpellInfo(spellID)
ChatFrame1:AddMessage(spell)
?

btw the _,_ isn't necessary since you only want the first return value
also i don't think there's any disadvantage to just using the spellName that you get from COMBAT_LOG_EVENT_UNFILTERED.
  Reply With Quote
04-28-08, 09:17 PM   #3
halpmeh
A Murloc Raider
Join Date: Feb 2008
Posts: 6
Originally Posted by Akryn View Post
also i don't think there's any disadvantage to just using the spellName that you get from COMBAT_LOG_EVENT_UNFILTERED.
Thanks for the advice.

Could you provide a quick example on how i could just use the spellName instead of my current method?

regards
  Reply With Quote
04-28-08, 09:21 PM   #4
Maccaa
A Fallenroot Satyr
 
Maccaa's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 27
Have you tested to make sure SpellID is arg10, I thought it was arg9
  Reply With Quote
04-28-08, 09:29 PM   #5
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Maccaa View Post
Have you tested to make sure SpellID is arg10, I thought it was arg9
doh, this. i should have checked that. :P

arg10 is spellName
  Reply With Quote
04-28-08, 10:11 PM   #6
Maccaa
A Fallenroot Satyr
 
Maccaa's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 27
Another error i believe is in your isEnemy check.

Checking it against srcFlags rather than dstFlags.

here is some code that works for me.

Code:
function Innervate_OnEvent(self, event, ...)
	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
		local _, cmbEvent, _, _, _, _, dstName, dstFlags = select(1, ...)
		if cmbEvent == "SPELL_AURA_APPLIED" then
			local isEnemy = (bit.band(dstFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE)
			local spellID = arg9
			if spellID == 29166 --[[Innervate]] and isEnemy then
				ChatFrame1:AddMessage("Vate Casted on "..dstName)
			end
		end
	end
end
  Reply With Quote
04-30-08, 01:50 PM   #7
halpmeh
A Murloc Raider
Join Date: Feb 2008
Posts: 6
Originally Posted by Maccaa View Post
Another error i believe is in your isEnemy check.

Checking it against srcFlags rather than dstFlags.

here is some code that works for me.

Code:
function Innervate_OnEvent(self, event, ...)
	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
		local _, cmbEvent, _, _, _, _, dstName, dstFlags = select(1, ...)
		if cmbEvent == "SPELL_AURA_APPLIED" then
			local isEnemy = (bit.band(dstFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE)
			local spellID = arg9
			if spellID == 29166 --[[Innervate]] and isEnemy then
				ChatFrame1:AddMessage("Vate Casted on "..dstName)
			end
		end
	end
end
Sent ya a msg, thx for the help guys.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need help on function for new combat log stuffs..


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off