View Single Post
05-20-17, 11:25 AM   #20
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Originally Posted by Kakjens View Post
Using itemID-s instead of names is a good idea. Saw that could be done but didn't want to overwhelm.
While still debugging, you might want to print itemId.
Don't know much of regular expressions but does string:match("item%d+):") recognize that instead of [item]x2 you want to record [item]? I think it does but you might need to test. Does it detect that if you roll for item but loose, and doesn't record?
Function Log_Loot isn't local.
You are not using variables after player, so they can be omitted.
I think players from another realm have "-realmname". You can test it by putting "else print(player)" after line 9, and running a random heroic/mythic without premade group.
Actually, I have a little more details in my actual addon which were not relevant to what I was asking here, so I omitted them. For example, I store other item info too (itemId, itemName, itemLevel, itemRequiredLevel, itemPrice, etc.). Also, I have an array of my own characters and I check if the player is in that array, so that it does the logging while playing with all my characters. What I have at the moment seems to work just fine. I will keep an eye on it though and see if it will continue to work correctly for various cases.

The string:match I used gets the item ID from the chat message. LootLog[itemId] = {} ensures no duplicate entries are made. LootLog = {} ensures the entries are saved between sessions, in other words, my log keeps growing as I play.

No idea about rolls yet, but the purpose of this addon is to log only items I acquire. There is one thing I am not sure if it will work, need to check it, some quests provide invisible reward items, that do not create a chat message, but their appearances are added to your Appearances. It won't be an issue though as I can manually add them to my database eventually, since they are recorded in the Appearances section.

Should I make the function local? How? and why?

Do you mean to remove other variables like this?

Lua Code:
  1. function Log_Loot(self, event, message, _, _, _, player)

I will test cross realm player names next time I do a dungeon.

Thanks so much.

Last edited by Eommus : 05-20-17 at 12:38 PM.
  Reply With Quote