ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   I need to Test and Event (https://www.esoui.com/forums/showthread.php?t=1080)

Sharlikran 04/21/14 08:21 PM

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?

Errc 04/21/14 08:58 PM

Quote:

Originally Posted by Sharlikran (Post 5263)
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.


All times are GMT -6. The time now is 12:46 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI