Quantcast My first attempt at modifying a tooltip - ESOUI
Thread Tools Display Modes
03/17/18, 05:34 PM   #1
nightstrike2
Join Date: Sep 2017
Posts: 8
My first attempt at modifying a tooltip

I'm getting the hang of writing these addons, but now I'm going to embark on a new path of trying to modify the item tooltips that pop up. Right now, I run with CraftStore (Rhyno's version), MM, and Master Recipe List, all of which modify these tooltips. It's very difficult to extract from their code bases, however, how to do this simply.

What I'd like to do specifically is modify the tooltips of achievement furnishings. Before you get the achievement, the tooltip text tells you in red what you need to do to be able to purchase it. After you get the achievement, the text is gone. I'd like to make an addon that, after you get the achievement, puts text in there (maybe in green) telling you what you did to be able to buy it.

Can I get some pointers on how to start this?
  Reply With Quote
03/17/18, 08:37 PM   #2
Dolgubon
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 273
Try using ItemTooltip:AddLine. You can check the esoui source code if you need examples
  Reply With Quote
03/18/18, 05:40 PM   #3
nightstrike2
Join Date: Sep 2017
Posts: 8
Thanks for the pointer. I seem to be on the right track with this:

Lua Code:
  1. local f = ItemTooltip["SetStoreItem"]
  2. ItemTooltip["SetStoreItem"] = function(self, index)
  3.     f(self, index)
  4.     local types = { GetStoreEntryTypeInfo(index) }
  5.     for i = 1, #types do
  6.         if (types[i] == ITEMFILTERTYPE_FURNISHING) then
  7.             self:AddLine("xxx")
  8.             break
  9.         end
  10.     end
  11. end

But now somehow I need to know whether the achievement text is already there. I used GetStoreItemLink on the entry and dumped it out to chat, and discovered that the item link itself doesn't contain the red achievement text in it. So, it gets added somewhere else. Do you know what adds that text, and how it gets added?

Last edited by nightstrike2 : 03/24/18 at 08:14 PM.
  Reply With Quote
03/22/18, 04:25 PM   #4
nightstrike2
Join Date: Sep 2017
Posts: 8
Anybody have some ideas here?
  Reply With Quote
03/24/18, 04:34 PM   #5
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 1,539
I'd check the esoui source code online at github and search the code for achievement or tooltip at the file which shows the tooltip.
https://github.com/esoui/esoui/tree/master/esoui

e.g. if you are in the inventory and hover the mouse above an item it should be some tooltip in the inventory, so check the ingame/inventory folder for files about tooltips etc.
https://github.com/esoui/esoui/tree/...game/inventory

Or just use the search at the top to search for wordings, function names etc. you know of being used in the consense. Maybe just check the itemtooltip files and check which functions are able to add lines -> scan for those in the total code.

Maybe it's the achievementtooltips file:
https://github.com/esoui/esoui/blob/...nttooltips.lua

Or this file here:
https://github.com/esoui/esoui/blob/...ltipstyles.lua

Check for e.g.
ZO_TOOLTIP_STYLES =
...
achievementDescriptionIncomplete

It could be the red line? Search for the usage of ZO_TOOLTIP_STYLES[achievementDescriptionIncomplete] this text/part and maybe you'll find where it get's added.

Last edited by Baertram : 03/24/18 at 04:39 PM.
  Reply With Quote
03/24/18, 08:50 PM   #6
nightstrike2
Join Date: Sep 2017
Posts: 8
Originally Posted by Baertram View Post
I'd check the esoui source code online at github and search the code for achievement or tooltip at the file which shows the tooltip.
https://github.com/esoui/esoui/tree/master/esoui

e.g. if you are in the inventory and hover the mouse above an item it should be some tooltip in the inventory, so check the ingame/inventory folder for files about tooltips etc.
https://github.com/esoui/esoui/tree/...game/inventory
It appears while in the store. Perhaps https://github.com/esoui/esoui/tree/...w_keyboard.lua?

Or just use the search at the top to search for wordings, function names etc. you know of being used in the consense. Maybe just check the itemtooltip files and check which functions are able to add lines -> scan for those in the total code.

Maybe it's the achievementtooltips file:
https://github.com/esoui/esoui/blob/...nttooltips.lua
I think that's for displaying tooltips in the Journal/Achievement window

Or this file here:
https://github.com/esoui/esoui/blob/...ltipstyles.lua

Check for e.g.
ZO_TOOLTIP_STYLES =
...
achievementDescriptionIncomplete

It could be the red line? Search for the usage of ZO_TOOLTIP_STYLES[achievementDescriptionIncomplete] this text/part and maybe you'll find where it get's added.
That's also for use in the Journal/Achievement window.

Is there a way to scan the live code in memory while in the game for the text that appears in the tooltip, to see what variable holds it or how it's getting generated? The text has to live somewhere.
  Reply With Quote
03/25/18, 07:21 AM   #7
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 1,539
Store (crown store) stuff is not accessible vua addons.

You are able to use zgoo /mouse to check for controls you host the mouse over (zgoo addon).
That way you get the name of controls and their nparent. This can be searched for in the src online and you'll find the xml file where the control is defined, it the usage in lua code.

You need to find the addition of the tooltip then. Try esoui/ingame/guildstore files maybe if you search for controls happening in the guild stores.
  Reply With Quote
03/25/18, 03:01 PM   #8
nightstrike2
Join Date: Sep 2017
Posts: 8
Specifically, I was looking at items in the achievement furnishing store. That's not the crown store, so are those accessible via addons?

I have zgoo installed, but I don't quite understand its output. I'll keep poking around.
  Reply With Quote
03/26/18, 12:31 PM   #9
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 1,539
zgoo /mouse is showing you a list of funcitons and variables available for the control below the mouse.
So if you find something like GetParent() it's the funcito getparent() which will show you the parent control of the control below your mouse.

You can expand the + in front of some tables to see the contents or click the : of the funciton (e.g. GetParent()) to get the parent control and show it's functions and variables.

This way you are able to find out the state of variables, funciton names and via the function GetName() the name of the control below the mouse.

If you searhc for this name or a part of the name (e.g. if the name is ZOFurnitureAchievementStoreRow1Column2 the name of the control you might be searching for would be ZOFurnitureAchievementStore).
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » My first attempt at modifying a tooltip

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