View Single Post
05-20-17, 03:36 AM   #15
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
Originally Posted by Eommus View Post
Thank you. It looks using CHAT_MSG_LOOT is more efficient than using BAG_UPDATE. I would assume, CHAT_MSG_LOOT is fired for any type of item acquisition. I will study how CHAT_MSG_LOOT works and try to use it instead.
You'll need to verify that the one due to whom is the event was your character (not party member - gamepedia article has info how to do it), and it's a item receive event (not, for example, selecting need/greed/pass/DE - gamepedia article doesn't disclose it but checking the OnEvent variables should make it possible).
Test it, with, for example, this:
Lua Code:
  1. local my_event = "CHAT_MSG_LOOT"
  2. local f = CreateFrame('Frame')
  3. f:RegisterEvent(my_event)
  4. f:SetScript('OnEvent', function(self, event, arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11, ...)
  5.     if event == my_event then
  6.         print("arg1=",arg1,"arg2=",arg2,"arg3=",arg3,"arg4=",arg4,"arg5=",arg5)
  7.         print("arg6=",arg6,"arg7=",arg7,"arg8=",arg8,"arg9=",arg9,"arg10=",arg10)
  8.         print("arg11=",arg11)
  9.     end
  10. end)
  Reply With Quote