Thread Tools Display Modes
01/30/18, 04:40 AM   #1
zykis39
Join Date: Jan 2018
Posts: 3
How to change object's title (Fishing)?

Hello! I am kinda trying out making first addon.
I want a fishing bait to be named under each source of fish.
Instead of standard "Fishing Hole" -> "Fishing Hole (Crawlers)" for example.
So, the question is: can i change title of the fishing holes? If yes, how can i achieve that? Thanks in advance!
  Reply With Quote
01/30/18, 05:55 AM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
Think of your question in a different way. Instead of renaming the fishing hole, you actually just want to display a different text under the cursor.

You can find the code for the cursor here: https://github.com/esoui/esoui/blob/...le/reticle.lua
By looking at it (I haven't tested it) the reticle text is set in this line:
https://github.com/esoui/esoui/blob/...ticle.lua#L237

You see that the function returns true, if a new text was set to the reticle/cursor, so you can do the following to change the displayed text:
Lua Code:
  1. local originalFunction = ZO_Reticle.TryHandlingInteraction -- remember the original function
  2. function ZO_Reticle:TryHandlingInteraction(...) -- override the function because we want to change the text
  3.     local success = originalFunction(self, ...) -- change the text as originally intended
  4.     -- if a new text was set
  5.     if success then
  6.         -- check if target is a fishing hole
  7.         local additionalInfo = select(5, GetGameCameraInteractableActionInfo())
  8.         if additionalInfo == ADDITIONAL_INTERACT_INFO_FISHING_NODE then
  9.             -- add the crawler information
  10.             self.interactContext:SetText(self.interactContext:GetText() .. " (Crawler)")
  11.         end
  12.     end
  13. end

I have not tested this code, it's just what I would try after reading the source code of ZO_Reticle. So beware of bugs.
  Reply With Quote
01/30/18, 06:52 AM   #3
zykis39
Join Date: Jan 2018
Posts: 3
Originally Posted by Shinni View Post
Think of your question in a different way. Instead of renaming the fishing hole, you actually just want to display a different text under the cursor.

You can find the code for the cursor here: https://github.com/esoui/esoui/blob/...le/reticle.lua
By looking at it (I haven't tested it) the reticle text is set in this line:
https://github.com/esoui/esoui/blob/...ticle.lua#L237

You see that the function returns true, if a new text was set to the reticle/cursor, so you can do the following to change the displayed text:
Lua Code:
  1. local originalFunction = ZO_Reticle.TryHandlingInteraction -- remember the original function
  2. function ZO_Reticle:TryHandlingInteraction(...) -- override the function because we want to change the text
  3.     local success = originalFunction(self, ...) -- change the text as originally intended
  4.     -- if a new text was set
  5.     if success then
  6.         -- check if target is a fishing hole
  7.         local additionalInfo = select(5, GetGameCameraInteractableActionInfo())
  8.         if additionalInfo == ADDITIONAL_INTERACT_INFO_FISHING_NODE then
  9.             -- add the crawler information
  10.             self.interactContext:SetText(self.interactContext:GetText() .. " (Crawler)")
  11.         end
  12.     end
  13. end

I have not tested this code, it's just what I would try after reading the source code of ZO_Reticle. So beware of bugs.
Wow! Looks like that's what i was looking for!
Would you suggest any resources, where i can grab a ZO_XXX class or functions descriptions? Didn't even knew of ZO_Reticle existance.
  Reply With Quote
01/30/18, 07:50 AM   #4
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by zykis39 View Post
Wow! Looks like that's what i was looking for!
Would you suggest any resources, where i can grab a ZO_XXX class or functions descriptions? Didn't even knew of ZO_Reticle existance.
Look here: http://www.esoui.com/downloads/info1...ourcecode.html
Source Code Documentation
Documentation Source Code
  Reply With Quote

ESOUI » General Discussion » Tech Chat » How to change object's title (Fishing)?

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