View Single Post
04-23-13, 04:32 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Spawnova View Post
I have an addon I would like to print a line once a certain item is looted/receieved
but it never seems to do anything past "if event=="


Code:
    local SKF = CreateFrame("frame")
	local playerName = UnitName("player")
	local keyName = "Scallions"

    SKF:RegisterEvent("CHAT_MSG_LOOT")
    SKF:SetScript("OnEvent",function(self,event,message)
		if event=="CHAT_MSG_LOOT" then
			local msg = string.gsub(message, "[", "")
                        print "event fired" --never fires
			if string.match(msg,"You receive item: " .. keyName) then
				print "looted"
			end
		end
    end)
print shound be like print("whatever")
  Reply With Quote