Quantcast Fish gutting snippet - ESOUI
Thread Tools Display Modes
03/07/15, 02:38 PM   #1
Randactyl
 
Randactyl's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 253
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!
__________________
Randactyl | NA Megaserver | Blood for the Pact!

My Addons
Check out my GitHub repos to follow my latest changes and see some addons before they are released.

Last edited by Randactyl : 03/07/15 at 02:45 PM.
  Reply With Quote
03/11/15, 05:01 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 496
Oh, yes. I see, I'm not the only one
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?
__________________
@votan73 (EU - megaserver)
  Reply With Quote
03/11/15, 10:52 AM   #3
Randactyl
 
Randactyl's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 253
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.
__________________
Randactyl | NA Megaserver | Blood for the Pact!

My Addons
Check out my GitHub repos to follow my latest changes and see some addons before they are released.
  Reply With Quote

ESOUI » AddOns » Alpha/Beta AddOns » Fish gutting snippet

Thread Tools
Display Modes

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