View Single Post
06/04/14, 10:36 PM   #1
jtsmith1287
Join Date: Mar 2014
Posts: 1
Assistance needed for registering events

So, I'm learning lua and the ESO API. I had an idea for a super simple addon, but getting just the basics down is proving to be a nightmare for me. I'm going to (embarrassingly) paste my code and ask that you guys tell me where I'm going wrong. What I'm looking to accomplish is getting the information of the items I'm looting, but I can't even get the dang loot event registered. And excuse the weird variable names--lots of poking and testing has been going on, as well as changing my addon idea a few times after learning of API restrictions. That and some of this is pasted examples from the esoui wiki.

When I gain loot, I want to see these items printed into chat via d() or something so I can start figuring this out. Thanks in advance for the help.

PileOMobs.lua
Code:
function lootReceived(receivedBy, itemName, quantity, itemSound, lootType, self)

  Loot:SetText("You looted stuff!!!")
  d(itemName)

  end
  
function RegisterLootEvent(eventcode, name)

  if (name == "PileOMobs") then
    PileOMobs:RegisterForEvent(EVENT_LOOT_RECEIVED, lootReceived)
    Loot:SetText("Loot event registered.")
    end

  end

function PileOMobsInit()

  EVENT_MANAGER:RegisterForEvent("PileOMobs", EVENT_ADD_ON_LOADED, RegisterLootEvent)

  end

PileOMobs.xml
Code:
<GuiXml>
    <Controls>
        <TopLevelControl name="Whatever">
            <Dimensions x="250" y="80" />
            <Anchor point="RIGHT" />

            <OnInitialized>
                PileOMobsInit()
            </OnInitialized>
 
            <Controls>
                <Label name="Loot" font="ZoFontGame" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="TOP" text="Got yerself a errawr">
                    <AnchorFill />
                </Label>
            </Controls>
        </TopLevelControl>
    </Controls>
</GuiXml>
  Reply With Quote