Why doesn't this piece of code work?
Hello, I have this code in my addon:
Code:
RegisterForEvent(EVENT_LOOT_RECEIVED, XL.OnItemLooted) 1) I verified that the IF works by pre-injecting my own strings into itemName. 2) The d(itemName) displays correctly formed item link in chat. How do I convert the itemName link to searchable string? Thanks! |
How exactly does itemName look like if the event callback function is triggered? What is in the variable? And what is shown if you post it to the chat using d(itemName)?
The event callback function parameters seem to be correct. EVENT_LOOT_RECEIVED (integer eventCode, string receivedBy, string itemName, number quantity, number itemSound, number lootType, boolean self, boolean isPickpocketLoot, string questItemIcon, number itemId) |
Quote:
Is it a unicode issue? |
No, it's the item's itemLink then, and not only the name of the item.
To get the item's name from that link use the function here: Code:
* GetItemLinkName(*string* _itemLink_) btw: Is it correct that your variable "bFound" is a global one? If you use global variables please create one global array for your addon's namespace like this Code:
myAddonName = {} Code:
myAddonName.bFound = false Lua Code:
|
Thanks that function solved the problem.
As for the globals, I did use the "local" keyword but I removed it to make the code shorter here. |
All times are GMT -6. The time now is 01:12 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI