Thread Tools Display Modes
04/21/14, 08:21 PM   #1
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 653
I need to Test and Event

There is an event EVENT_LOOT_RECEIVED and there are a few different ways of defining it. The way that seems to be working is this
Lua Code:
  1. function Harvest.OnLootReceived( eventCode, receivedBy, objectName, stackCount, soundCategory, lootType, lootedBySelf )
The Wiki is reporting it as (string receivedBy, string itemName, integer quantity, integer itemSound, integer lootType, bool self) which is one less parameter. I think tha the last parameter is important because I use it. Currently it's used in HarvestMap to see if the player looted the item. They can't both be right.

Can I call the event like, var1, var2, var3, var4, var5, var6, var7 = EVENT_LOOT_RECEIVED or do i need to register an event like "EVENT_MANAGER:RegisterForEvent("HarvestMap", EVENT_LOOT_RECEIVED, Harvest.OnLootReceived)" to that it will fire on auto loot and then try to decode those variables.

What is the best way to go about checking that?
  Reply With Quote
04/21/14, 08:58 PM   #2
Errc
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 30
Originally Posted by Sharlikran View Post
There is an event EVENT_LOOT_RECEIVED and there are a few different ways of defining it. The way that seems to be working is this
Lua Code:
  1. function Harvest.OnLootReceived( eventCode, receivedBy, objectName, stackCount, soundCategory, lootType, lootedBySelf )
The Wiki is reporting it as (string receivedBy, string itemName, integer quantity, integer itemSound, integer lootType, bool self) which is one less parameter. I think tha the last parameter is important because I use it. Currently it's used in HarvestMap to see if the player looted the item. They can't both be right.

Can I call the event like, var1, var2, var3, var4, var5, var6, var7 = EVENT_LOOT_RECEIVED or do i need to register an event like "EVENT_MANAGER:RegisterForEvent("HarvestMap", EVENT_LOOT_RECEIVED, Harvest.OnLootReceived)" to that it will fire on auto loot and then try to decode those variables.

What is the best way to go about checking that?
EVENT_MANAGER:RegisterForEvent("HarvestMap", EVENT_LOOT_RECEIVED, Harvest.OnLootReceived) is the correct way to go about it because var1, var2, var3, var4, var5, var6, var7 = EVENT_LOOT_RECEIVED wouldn't do anything. Var1 would get assigned whatever random integer EVENT_LOOT_RECEIVED is and nothing else.

Best way to investigate events would be using zgoo imo. '/zgoo events' will bring up a frame that registers every event and you can examine their return values. You can block the events you don't want to see by clicking the X next to them, and expand to see return values with +. To avoid the hassle of Xing all events you don't want you could change the source code in Events.lua/Events:RegisterAllEvents() to only register the events you are concerned with.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » I need to Test and Event


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off