Download
(10 Kb)
Download
Updated: 10/30/23 09:25 PM
Pictures
File Info
Compatibility:
Endless Archive (9.2.5)
base-game patch (9.1.5)
Necrom (9.0.0)
Scribes of Fate (8.3.5)
Firesong (8.2.5)
Lost Depths (8.1.5)
High Isle (8.0.0)
Updated:10/30/23 09:25 PM
Created:05/16/21 12:49 PM
Monthly downloads:300
Total downloads:9,172
Favorites:29
MD5:
Take One  Popular! (More than 5000 hits)
Version: 1.1.6
by: mightyjo [More]
Take One
Author: Mightyjo

Depends on:
- LibAddonMenu-2.0
- LibCustomMenu
- LibDebugLogger

Optionally depends on:
- DebugLogViewer

This add-on provides a context menu option to pull one item from a Bank or Guild Bank stack into your inventory.

The context menu item will only appear when all the preconditions to use it are met
- The source slot is in your Bank or Guild Bank.
- You have permission to withdraw and deposit into the Guild Bank.
- You have 2 free backpack slots (for Guild Bank withdrawals).
- The source stack contains more than 1 item.

Requires 2 free slots in your backpack
When working with the Guild Bank it really just automates the process of withdrawing the whole stack in a bank slot, splitting out one item from the stack, and returning the remaining stack to the Guild Bank. Consequently, you must have 2 free slots in your backpack to withdraw 1 item from a Guild Bank stack. Annoying, but that's what the API allows.

Settings
You can turn on debug logging if you're having a problem. If you have DebugLogViewer installed you'll be able to see the add-on working in a UI window. Otherwise, the log is stored in your saved variables by LibDebugLogger whenever you quit or /reloadui.

Support
If you need help, find a bug, or have a translation post here. You can also open an issue or pull request on the GitHub: https://github.com/Mightyjo/TakeOne/issues.


Thanks
Many thanks to the authors whose examples I followed:
- @Marify
- Valandil
- @Architectura
- @Magnum1997
- Wobin
- CrazyDutchGuy
- Ayantir
- silvereyes
- Baertram

License



This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Archived Files (9)
File Name
Version
Size
Uploader
Date
1.1.5
10kB
mightyjo
04/14/23 06:52 PM
1.1.4
10kB
mightyjo
06/06/22 09:02 PM
1.1.3
10kB
mightyjo
03/18/22 05:59 PM
1.1.2
10kB
mightyjo
08/23/21 08:01 PM
1.1.1
10kB
mightyjo
05/26/21 12:13 AM
1.1.0
10kB
mightyjo
05/25/21 11:02 PM
1.0.2
9kB
mightyjo
05/21/21 06:14 PM
1.0.1
9kB
mightyjo
05/20/21 09:57 PM
1.0.0
9kB
05/16/21 12:49 PM


Post A Reply Comment Options
Unread 05/19/21, 07:23 PM  
EgotisticalElf

Forum posts: 0
File comments: 22
Uploads: 0
I love the idea, though my context menu gets messy..



Thoughts?
Last edited by EgotisticalElf : 05/19/21 at 07:24 PM.
Report comment to moderator  
Reply With Quote
Unread 05/20/21, 07:09 AM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 17
Uploads: 2
Originally Posted by EgotisticalElf
I love the idea, though my context menu gets messy..



Thoughts?
Thanks! I have a hunch it's an interaction between LibCustomMenu and an older way of inserting context menu items. Thought I'd guarded against it correctly.

Would you mind posting a list of the add-ons that are augmenting your menus? It'll help me reproduce the error.
Report comment to moderator  
Reply With Quote
Unread 05/20/21, 07:37 PM  
EgotisticalElf

Forum posts: 0
File comments: 22
Uploads: 0
Originally Posted by mightyjo
Originally Posted by EgotisticalElf
I love the idea, though my context menu gets messy..



Thoughts?
Thanks! I have a hunch it's an interaction between LibCustomMenu and an older way of inserting context menu items. Thought I'd guarded against it correctly.

Would you mind posting a list of the add-ons that are augmenting your menus? It'll help me reproduce the error.
Inventory Insight
Personal Assistant
FCO Item Saver

that's just off the top of my head.

shouldn't everyone be using libCustomMenu by now ?
Report comment to moderator  
Reply With Quote
Unread 05/20/21, 09:50 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 17
Uploads: 2
Originally Posted by EgotisticalElf

Inventory Insight
Personal Assistant
FCO Item Saver

that's just off the top of my head.

shouldn't everyone be using libCustomMenu by now ?
Thanks! I was able to reproduce it with FCOIS and PA installed. Looks like we're all trying to put our menus in the same spot. Moving Take One to just under "Withdraw" fixed it.

Update incoming.
Report comment to moderator  
Reply With Quote
Unread 05/21/21, 08:59 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5990
Uploads: 78
If you use LibCustomMenu "properly" to register an inventory context menu this shouldn't be any problem.
You shouldn't palce your entries behind special other entries but just use the lib's constants (e.g. LibCustomMenu.CATEGORY_PRIMARY like you do now) for add early, or late e.g.
Else you'll always run into the same problems with many addons using the lib.

btw if your entry to the contextmenu does NOT use any keybindings you can simply use your function TakeOne:ShowContextMenu(inventorySlot, slotActions)
and add a new contextmenu entry like this:

AddCustomMenuItem(...)
or
AddCustomSubMenuItem(...) if you want to show your entries inside a submenu.

instead of using slotActions:AddCustomSlotAction(...)

Lua Code:
  1. function TakeOne:ShowContextMenu(inventorySlot, slotActions)
  2.  
  3.     -- Check inventorySlot validity
  4.     if not self:isValid(inventorySlot) then
  5.         return
  6.     end
  7.  
  8.     local bagId, slotIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
  9.     local itemLink = GetItemLink(bagId, slotIndex)
  10.     local itemId = GetItemLinkItemId(itemLink)
  11.  
  12.     self:Debug(" BagID: <<1>>;  slotIndex: <<2>>; itemId: <<3>>", bagId, slotIndex, itemId)
  13.     --slotActions:AddCustomSlotAction(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end, "")
  14.     AddCustomMenuItem(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end)
  15.  
  16. end

The slot action changes is only needed if you also want to change the slot stuff like add a keybinding for it.

Originally Posted by mightyjo
Originally Posted by EgotisticalElf

Inventory Insight
Personal Assistant
FCO Item Saver

that's just off the top of my head.

shouldn't everyone be using libCustomMenu by now ?
Thanks! I was able to reproduce it with FCOIS and PA installed. Looks like we're all trying to put our menus in the same spot. Moving Take One to just under "Withdraw" fixed it.

Update incoming.
btw: your variable for the character SVs are never used: self.savedCharVariables
You should remove them so they do not create the tables in the SV files for nothing.
Last edited by Baertram : 05/21/21 at 09:11 AM.
Report comment to moderator  
Reply With Quote
Unread 05/21/21, 05:27 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 17
Uploads: 2
Thanks Baetram! You cleared up a bunch of questions I'd been trying to feel my way through.

Originally Posted by Baertram
If you use LibCustomMenu "properly" to register an inventory context menu this shouldn't be any problem.
You shouldn't palce your entries behind special other entries but just use the lib's constants (e.g. LibCustomMenu.CATEGORY_PRIMARY like you do now) for add early, or late e.g.
Else you'll always run into the same problems with many addons using the lib.
I used LibCustomMenu.CATEGORY_LATE in v1.0.0 when the menus got clobbered. I take your point, though. I was concerned using CATEGORY_PRIMARY would be fragile. I'm betting your next tip sets this all straight.

Originally Posted by Baertram
btw if your entry to the contextmenu does NOT use any keybindings you can simply use your function TakeOne:ShowContextMenu(inventorySlot, slotActions)
and add a new contextmenu entry like this:

AddCustomMenuItem(...)
or
AddCustomSubMenuItem(...) if you want to show your entries inside a submenu.

instead of using slotActions:AddCustomSlotAction(...)

Lua Code:
  1. function TakeOne:ShowContextMenu(inventorySlot, slotActions)
  2.  
  3.     -- Check inventorySlot validity
  4.     if not self:isValid(inventorySlot) then
  5.         return
  6.     end
  7.  
  8.     local bagId, slotIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
  9.     local itemLink = GetItemLink(bagId, slotIndex)
  10.     local itemId = GetItemLinkItemId(itemLink)
  11.  
  12.     self:Debug(" BagID: <<1>>;  slotIndex: <<2>>; itemId: <<3>>", bagId, slotIndex, itemId)
  13.     --slotActions:AddCustomSlotAction(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end, "")
  14.     AddCustomMenuItem(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end)
  15.  
  16. end

The slot action changes is only needed if you also want to change the slot stuff like add a keybinding for it.
Ah, thanks! I misinterpreted the examples to mean RegisterContextMenu and AddCustomSlotAction were paired. Much obliged.

Originally Posted by Baertram
btw: your variable for the character SVs are never used: self.savedCharVariables
You should remove them so they do not create the tables in the SV files for nothing.
Copy that. The Debug function in LibMarify uses the SVs. I'll look for a lighter-weight solution.
Report comment to moderator  
Reply With Quote
Unread 05/22/21, 09:51 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5990
Uploads: 78
I used LibCustomMenu.CATEGORY_LATE in v1.0.0 when the menus got clobbered. I take your point, though. I was concerned using CATEGORY_PRIMARY would be fragile. I'm betting your next tip sets this all straight.
Could be that the action slot function was causing the problems with the context menu. I had asked Votan already a few weeks ago about this, as another addon "CustomItemNote" got the same problem using the action slot example from LibCustomMenu with LibCustomMenu.CATEGORY_LATE.
Maybe he found the problm and knows a fix then.

If you try the same, LibCustomMenu.CATEGORY_LATE, but only use AddCustomMenuItem it should work properly.
Last edited by Baertram : 05/22/21 at 09:52 AM.
Report comment to moderator  
Reply With Quote
Unread 05/22/21, 12:21 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 17
Uploads: 2
Originally Posted by Baertram
Could be that the action slot function was causing the problems with the context menu. I had asked Votan already a few weeks ago about this, as another addon "CustomItemNote" got the same problem using the action slot example from LibCustomMenu with LibCustomMenu.CATEGORY_LATE.
Maybe he found the problm and knows a fix then.

If you try the same, LibCustomMenu.CATEGORY_LATE, but only use AddCustomMenuItem it should work properly.
Yep! It works correctly now. Uploaded the fix last night. Thanks again!
Report comment to moderator  
Reply With Quote
Unread 05/24/21, 10:42 PM  
arps

Forum posts: 0
File comments: 18
Uploads: 0
thanks

great addon thank you so much!
Report comment to moderator  
Reply With Quote
Unread 05/25/21, 11:41 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 17
Uploads: 2
Broke something in v1.1.0

Just broke something. I'll have it fixed in a jiffy.
Report comment to moderator  
Reply With Quote
Unread 05/26/21, 12:17 AM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 17
Uploads: 2
v1.1.1

Everything is fine. Nothing is ruined. Hope nobody saw that embarrassing display.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: