View Single Post
01/14/17, 03:42 PM   #1
Augestflex
Join Date: Jan 2016
Posts: 4
LootAll for ITEMTYPE_CONTAINER After UseItem

Hello!


This is my first post in the developer discussions, and I hope I got the right sub topic, so please bear with me and thank you in advance for any assistance or comments. I have been searching through the very wonderful wiki and API calls as well as looking through other addon code.

I'm working on my first ESO LUA addon, with great help from looking at exiting addons. Note I do not have LUA experience but I have spent around 10 years programming with strongly typed languages though the syntax of LUA is driving me nuts (I am learning... ok slowly).

Now for the problem:
From the user's inventory I've called "UseItem" using CallSecureProtected passing in the bag and slotIndex on an item type of ITEMTYPE_CONTAINER. This pops up a loot window with several items that are in the container sitting in the loot window. All I want to do for this step is loot all these items, but I can't seem to hook into being able to interact with this loot window.

Additionally I've registered for events of EVENT_LOOT_UPDATED thinking this would give me an event call to my addon method that I could then interact with. Here is how I registered for the event:

Code:
EVENT_MANAGER:RegisterForEvent(addon.name, EVENT_LOOT_UPDATED, LootAllContents)
Note that I've tried implementing both of the following and I never see the debug messages for entering and leaving my LootallContents method though I see my debug messages elsewhere, and obviously since the loot window opens up I know I've at least made it that far. conPrint just implements d().

Code:
-- lootall with eventcode passed
local function LootAllContents(eventCode)
conPrint("Entering LootAllContents")
  LootAll(true)
conPrint("Leaving LootallContents")
end

-- lootall with no params passed
local function LootAllContents()
conPrint("Entering LootAllContents")
  LootAll(true)
conPrint("Leaving LootallContents")
end

Any thoughts on what I am doing wrong? I'm sure I am either missing something totally simple/obvious.


Thanks in advance for any comments and advice.

Last edited by Augestflex : 01/15/17 at 01:28 PM.
  Reply With Quote