View Single Post
02/12/23, 07:41 AM   #4
Matoro342
Join Date: Feb 2023
Posts: 9
Originally Posted by votan View Post
Hi Matoro342,

basically you hook the SetItem method of ItemTooltip and you are at the right place already.
This method is called to show the tooltip of an item, including the player's inventory.
You get the itemLink, you can get the itemId from it with GetItemLinkItemId. (and all other information, like style, from it)

Take a look at https://www.esoui.com/downloads/info...eTooltips.html and feel free to use the code to start with.
I am assuming that the SetItem function is setting what the tooltip displays? Looking at your code, I am flabbergasted how everything runs even though you only run an event manager for startup. But anyways, in your HookBagTips you have
Lua Code:
  1. TooltipHook(ItemTooltip, "SetBagItem", GetItemLink)
which goes to
Lua Code:
  1. local function TooltipHook(tooltipControl, method, linkFunc)
  2.     local origMethod = tooltipControl[method]
  3.  
  4.     tooltipControl[method] = function(self, ...)
  5.         origMethod(self, ...)
  6.         AddRuneInfo(self, GetRuneInfoText(linkFunc(...)))
  7.     end
  8. end
but I'll be honest, I have no idea what that does or why. It looks very clever, easily handling multiple kinds of tooltips, and I'd love to use it since I could then apply to loot or whatever, but yeah, it confuses me.
I've made some progress, using moc() and d() to display at least some info after hovering over items. I still don't exactly know how to edit or access the tooltip, my guess is tooltip functions are accessed through item links, is that correct? I must be dumb because I don't understand if ItemTooltip is an object or a property of one.

Originally Posted by Baertram View Post
Each inventory row got a dataEntry table with a subtable data where you'll find the slots info like itemId, bagId, slotIndex etc.
You can use the function moc() to get the control below your mouse. Read moc's .dataEntry.data then and either use the bagId and slot Index with API functions like GetItem*(bagId, slot Index).

Or for your usecase do at best like shown by votan as you want to add something to the tooltip. ItemLink's are a string containing much info of the dataEntry.data of the slot too. You can create an itemLink from a bagId & slot Index via GetItemLink(bagId, slotIndex).

Tools like merTorchbug updated or zgoo can be used to inspect the control below the mouse and view its data and subtables too. They visualize you the contents. Use /tbm above the control (inventory row) or /zgoo mouse
I have been able to get item info out of the hovered over items, and your advice here with the dataEntry.data which seems to appear nowhere I found in the API helped me crack that. I still don't know what to do about tooltips though.
  Reply With Quote