View Single Post
08/08/19, 03:53 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by cOOLsp0T View Post
Hi Folks,

At the moment I try to build an automated action for looting. It does as follows.


On Addon Load -> Register LootInit for EVENT_LOOT_UPDATED

When Player Loots:
Unregister for EVENT_LOOT_UPDATED -> (When lootitem = false) Register SetGlobalData for EVENT_INVENTORY_SINGLE_SLOT_UPDATE
LootItembyID <- because we would fire on the Inventory Single Slot Update Event
CallBack ItemSort <- and here starts the Problem. The Game hasnt forwarded to the next frame and the data is given empty.

I also tried to build up a chain with Register Handshakes without using a for loop, but this also dont work, because I allways have to wait till the game has made the frame before I get the needed dataset.

How can I get sure, that the game has processed a frame, before I do my next action or is there a trick for parallelizing this?
EVENT_MANAGER:RegisterForUpdate(identifier, 0, function() EVENT_MANAGER:UnregisterForUpdate(identifier) end)
The function is called on the next frame, because the timeout of zero will be over.
identifier is a unique string. Whatever you want, but it has to be unique.
  Reply With Quote