ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Alpha/Beta AddOns (https://www.esoui.com/forums/forumdisplay.php?f=171)
-   -   Fish gutting snippet (https://www.esoui.com/forums/showthread.php?t=4386)

Randactyl 03/07/15 02:38 PM

Fish gutting snippet
 
Made this real quick to use all of my hundreds of fish items. There aren't really any safety checks, so it needs to be used responsibly (use it on fish!)

Lua Code:
  1. local function AddContextMenuOption(rowControl)
  2.     local bagId = rowControl.bagId
  3.     local slotIndex = rowControl.slotIndex
  4.  
  5.     AddMenuItem("Use All", function()
  6.             local delay = 0
  7.             for i = 1, rowControl.stackCount do
  8.                 zo_callLater(function() CallSecureProtected("UseItem", bagId, slotIndex) end, delay)
  9.                 delay = delay + 2000
  10.             end
  11.         end, MENU_ADD_OPTION_LABEL)
  12.  
  13.     ShowMenu(self)
  14. end
  15.  
  16. local function AddContextMenuOptionSoon(rowControl)
  17.     zo_callLater(function() AddContextMenuOption(rowControl) end, 50)
  18. end
  19.  
  20. ZO_PreHook("ZO_InventorySlot_ShowContextMenu", AddContextMenuOptionSoon)

If anyone wants to make something of this, go for it.

edit: one nice change would be disabling the "Fish acquired." center screen announcement!

votan 03/11/15 05:01 AM

Oh, yes. I see, I'm not the only one :D
Wish, it were so easy :)

But I did handle that "Fish acquired." center screen announcement.
The message is not part of any LUA code. It's coming from the client itself.

The safety checks killing me. ;)

Did you ever had the issue, that even the first "UseItem" call fails?

Randactyl 03/11/15 10:52 AM

Nope, never had problems with calls to UseItem once I got the delay timing down for zo_callLater. After filleting more than 2000 fish, I don't recall there ever being a problem with the first call.


All times are GMT -6. The time now is 12:42 AM.

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