Thread Tools Display Modes
01-11-09, 01:43 AM   #1
Kanyin
A Defias Bandit
Join Date: Apr 2006
Posts: 3
Why does this print to chat twice?

local CL = CreateFrame("Frame", "extCombatlog", UIParent)

CL:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
CL:SetScript("OnEvent", function()

-- Player vs. Player
-- Druid
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
if arg2 == "SPELL_AURA_APPLIED" then
if arg7 == UnitName("player") then
if arg10 == "Cyclone" then
SendChatMessage("Do Not Dispel: Cyclone[Immune]")
end
end
end
end
end)

So far this addon works. The problem is it performs the SendChatMessage(Do Not Dispel: Cycline[Immune]") part to the chat frame twice. Take into account I know nothing about LUA and I'm tryin to write an addon to learn a little bit. Thanks for any help in advance.
  Reply With Quote
01-11-09, 04:53 AM   #2
Mera
Retired of WoW, In ESO :)
 
Mera's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 331
probably the event happening twice you will have to code it with more precision, first take DevTools and you can now debug events in realtime with /dtevents command.
__________________
If you need to reach me I'm in ESO, @class101 or "Fathis Ules i"
addons: SpamBayes, BrokerCPU
projects: ThunderBayes
Mera[xeh]? - La CroisadeEcarlate (wow)
  Reply With Quote
01-12-09, 01:33 AM   #3
Kanyin
A Defias Bandit
Join Date: Apr 2006
Posts: 3
The event does fire twice but they both have the same calls. Could someone give me some tips on how to write an event handler? I've heard that thrown around to fix problems like this but I have no clue how to do it.
  Reply With Quote
01-12-09, 04:22 AM   #4
Kanyin
A Defias Bandit
Join Date: Apr 2006
Posts: 3
Woohoo figured it out. Don't need help anymore DDD
  Reply With Quote
01-12-09, 04:30 AM   #5
Codermik
A Deviate Faerie Dragon
 
Codermik's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 16
Originally Posted by Kanyin View Post
local CL = CreateFrame("Frame", "extCombatlog", UIParent)

CL:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
CL:SetScript("OnEvent", function()

-- Player vs. Player
-- Druid
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
if arg2 == "SPELL_AURA_APPLIED" then
if arg7 == UnitName("player") then
if arg10 == "Cyclone" then
SendChatMessage("Do Not Dispel: Cyclone[Immune]")
end
end
end
end
end)

So far this addon works. The problem is it performs the SendChatMessage(Do Not Dispel: Cycline[Immune]") part to the chat frame twice. Take into account I know nothing about LUA and I'm tryin to write an addon to learn a little bit. Thanks for any help in advance.
Glad you got it working, thing to note though is that testing for the spell name is not really a suitable way to be honest unless its for personal use only. Remember that in other countries that dont use the english client this test would fail.

Good luck with the coding.
__________________
Codermik
www.twitch.tv/codermik
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Why does this print to chat twice?


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