ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   ZO_SmithingTopLevelCreationPanelResultTooltip.SetPendingSmithingItem hook (https://www.esoui.com/forums/showthread.php?t=6075)

Wandamey 02/07/16 02:42 PM

ZO_SmithingTopLevelCreationPanelResultTooltip.SetPendingSmithingItem hook
 
I'm having a problem with some tootlip edition

At the gear crafting stations (clothier, carpenter, blacksmith)

In creation mode, i can't seem to get a valid info from GetSmithingPatternResultLink(...) with the args I get from ZO_SmithingTopLevelCreationPanelResultTooltip.SetPendingSmithingItem anymore (the hook was working till TG) and get this error :
Quote:

Checking type on argument linkStyle failed in GetSmithingPatternResultLink_lua
stack traceback:
[C]: in function 'GetSmithingPatternResultLink'
user:/AddOns/TheHookingAddon/TheHookingAddon.lua:663: in function 'SetPendingSmithingItem'
EsoUI/Ingame/Crafting/Keyboard/SmithingCreation_Keyboard.lua:194: in function 'ZO_SmithingCreation:SetupResultTooltip'
EsoUI/Ingame/Crafting/SmithingCreation_Shared.lua:895: in function 'ZO_SharedSmithingCreation:UpdateTooltipInternal'
EsoUI/Ingame/Crafting/SmithingCreation_Shared.lua:37: in function 'ZO_SharedSmithingCreation:OnUpdate'
EsoUI/Ingame/Crafting/SmithingCreation_Shared.lua:32: in function '(anonymous)'
probably an issue with the new crown store component?

---
I have to retrieve each var from this instead in creation mode :
local pat,mat,qtt,style,trait =
SMITHING.creationPanel:GetSelectedPatternIndex(),
SMITHING.creationPanel:GetSelectedMaterialIndex(),
SMITHING.creationPanel:GetSelectedMaterialQuantity(),
SMITHING.creationPanel:GetSelectedStyleIndex(),
SMITHING.creationPanel:GetSelectedTraitIndex()
local itemLink = GetSmithingPatternResultLink(pat,mat,qtt,style,trait) and then it's working.

Edit : Got it working like that too :
Quote:

local PendingSmithingItemTooltip = ZO_SmithingTopLevelCreationPanelResultTooltip.SetPendingSmithingItem
ZO_SmithingTopLevelCreationPanelResultTooltip.SetPendingSmithingItem = function(control,pat,mat,qtt,style,trait,...)
PendingSmithingItemTooltip(control,pat,mat,qtt,style,trait,...)
local itemLink = GetSmithingPatternResultLink(pat,mat,qtt,style,trait)
EditTooltip(control, itemLink)
end
it appears that SetPendingSmithingItem() receives 2 extra arguments, a boolean (crown store I assume and the other got me only nil)
I don't know why too many arguments makes GetSmithingPatternResultLink(...) go wild, but it does. -- Erratum it's only 1 new argument, and is a bool

Re Edit : /facepalm it's an error about linkStyle, not Style so yes I know why it gets wild. Because the bool was added at the same place where linkStyle is in the other function
Chiiiiiiiiiiiiiiiiiiiiiiiiiiiip!

circonian 02/07/16 04:39 PM

Quote:

Originally Posted by Wandamey (Post 25915)
I'm having a problem with some tootlip edition

At the gear crafting stations (clothier, carpenter, blacksmith)

In creation mode, i can't seem to get a valid info from GetSmithingPatternResultLink(...) with the args I get from ZO_SmithingTopLevelCreationPanelResultTooltip.SetPendingSmithingItem anymore (the hook was working till TG) and get this error :

Yes it is an error about the linkStyle.

If your trying to create a link for the item that's currently being created theres a function to get all of those arguments:
Lua Code:
  1. local patternIndex, materialIndex, materialQuantity, styleIndex, traitIndex, isUsingUniversalStyle = SMITHING.creationPanel:GetAllCraftingParameters()
  2. -- Don't try to use this: isUsingUniversalStyle  as the last parameter,
  3. -- its the wrong type which is what you were trying to use
  4. local link = GetSmithingPatternResultLink(patternIndex, materialIndex, materialQuantity, styleIndex, traitIndex)
  5. d(link)

As for the Boolean argument you mentioned: isUsingUniversalStyle, its not extra its just that the last argument is different. It is because GetSmithingPatternResultLink takes a linkStyle as its last parameter and SetupResultTooltip/SetPendingSmithingItemTooltip takes a Boolean as its last parameter which is isUsingUniversalStyle that is returned from GetAllCraftingParameters() or SMITHING.creationPanel.GetIsUsingUniversalStyleItem()
Lua Code:
  1. function ZO_SharedSmithingCreation:GetAllCraftingParameters()
  2.     return self:GetSelectedPatternIndex(), self:GetSelectedMaterialIndex(),
  3.            self:GetSelectedMaterialQuantity(), self:GetSelectedStyleIndex(), self:GetSelectedTraitIndex(), self:GetIsUsingUniversalStyleItem()
  4. end

Lua Code:
  1. local creationPanel = SMITHING.creationPanel
  2. creationPanel:SetupResultTooltip(creationPanel:GetAllCraftingParameters())

SetupResultTooltip(...) is what calls your: SetPendingSmithingItemTooltip(...), passing it all of its parameters.
Lua Code:
  1. function ZO_SmithingCreation:SetupResultTooltip(...)
  2.     self.resultTooltip:SetPendingSmithingItem(...)
  3. end

Wandamey 02/07/16 04:54 PM

yeah i get it now, but i was focusing on the "style" items and i misread the error. Besides i always leave LinkStyle blank, and I had no mention of it in my own addons. I forgot it a bit :)
For these items I got a handfull of ways of gettin the link.

and I said the args I get from SetPendingSmithingItem because i used function(control, ...) in my hook before TG. I dunno the technical words and for me it's just a way to get the hang on the needed vars to get my itemlink in the end.
And also have it working with a common function for all hooks. But that is dead for this tooltip now.

so (...) until now was working for GetSmithingPatternResultLink(...) but with TG, that bool break the linkStyle. I say extra arg because it didn't exist before TG.
It would be nice to add a dummy bool in GetSmithingPatternResultLink arguments or a dummy linkStyle in SetPendingSmithingItem
edit : or easier : limit the number of args for SetPendingSmithingItem to 5 ? i doubt the use of the crown item changes the item tooltip...

Until now there were always a symetry between the args of methods that set the tooltip and the ones that retrieve the itemLink. And that was convenient.

circonian 02/07/16 04:58 PM

Quote:

Originally Posted by Wandamey (Post 25920)

and I said the args I get from SetPendingSmithingItem because i used function(control, ...) in my hook before TG. I dunno the technical words and for me it's just a way to get the hang on the needed vars to get my itemlink in the end.
And also have it working with a common function for all hooks. But that is dead for this tooltip now.

so (...) until now was working for GetSmithingPatternResultLink(...) but with TG, that bool break the linkStyle. I say extra arg because it didn't exist before TG. and the nil that comes after is i suppose linkStyle. This one was there before.
It would be nice to add a dummy bool in GetSmithingPatternResultLink arguments or put it at the end in SetPendingSmithingItem

Yeah, I edited my post. I didn't put it together with the code that you were hooking it so that's where you were "getting" them from. Makes perfect sense.
I don't know why it would have changed. As you said, if it is something new they added (isUsingUniversalStyle), then that would explain why it worked before. Because you can leave linkStyle nil, and if isUsingUniversalStyle did not exist before you would have been passing nil for linkStyle.

Wandamey 02/07/16 05:08 PM

yes it is new, it's a crown store item than can replace any style matérial (where my confusion on the error came from at first)
it's a checkbox. a new one that will come with Thieves Guild

Edit: I wrote "hook" in the post title, but this control name is so long, no eye can reach there :D


here how it was before (source : wiki of last summer) :
## SetPendingSmithingItem(luaindex patternIndex, luaindex materialIndex, integer materialQuantity, luaindex styleIndex, luaindex traitIndex)

so yes i was passing nil, but now if i display the args I got : index,index,index,index,index,bool,nil ... haven't checked the updated function yet. obviously the bool is for isUsingUniversalStyle, but the nil?

circonian 02/07/16 08:01 PM

Quote:

Originally Posted by Wandamey (Post 25922)
so yes i was passing nil, but now if i display the args I got : index,index,index,index,index,bool,nil ... haven't checked the updated function yet. obviously the bool is for isUsingUniversalStyle, but the nil?

The 7th parameter is nil because there is no 7th parameter, there are only 6.
Lua Code:
  1. SMITHING.creationPanel:SetPendingSmithingItem(...)
  2. -- is called from:
  3. SMITHING.creationPanel:SetupResultTooltip(...)
and SetupResultTooltip(...) is passed the return values from: SMITHING.creationPanel:GetAllCraftingParameters() which only returns 6 values so there are only 6 parameters. See my code posts above.

Wandamey 02/08/16 05:08 AM

ha ha right i messed up my debug. only 6 then. i edit the posts above for them to be less confusing

Ayantir 02/17/16 01:12 AM

My little dirty fix

Lua Code:
  1. -- TooltipControl:SetPendingSmithingItem() waits a boolean as 6th arg and GetSmithingPatternResultLink waits for a facultative integer, so drop it
  2. local itemLink
  3. if method == "SetPendingSmithingItem" then
  4.     local args = {...}
  5.     itemLink = linkFunc(args[1], args[2], args[3], args[4], args[5])
  6. else
  7.     itemLink = linkFunc(...)
  8. end

Ayantir 03/07/16 10:33 PM

Seems Chip forgot to update his ZO_Ingame addon !


Lua Code:
  1. Checking type on argument linkStyle failed in GetSmithingPatternResultLink_lua
  2. stack traceback:
  3.     [C]: in function 'GetSmithingPatternResultLink'
  4.     EsoUI/Libraries/Utility/ZO_LinkHandler.lua:122: in function 'ZO_LinkHandler_CreateChatLink'
  5.     EsoUI/Ingame/Crafting/Keyboard/SmithingCreation_Keyboard.lua:42: in function 'OnTooltipMouseUp'

Right click on any tooltip at craft station :D

ZOS_ChipHilseberg 03/08/16 02:21 PM

Guilty as charged.

MagiczneTornado 03/14/16 12:58 PM

How do i fix it?


Do i have to do something (im addon user, not creator)?


There was an incremental patch today and even after update this is still happening to me when i try to link any crafting item from station before crafting it.

Wandamey 03/14/16 01:15 PM

The error when you link is not from the addons.
It's the same cause, but we can't do anything about it on our own.

Just wait and avoid linking from the gear crafting stations :o

Edit: well maybe we could rewrite the function in cause in a mini-patch


the fix below is included in the next post atached zip. (thx votan)
(you dont need to paste it yourself, just use the patch addon that votan linked)

-- just put the unzipped folder in Documents/Elders Scrolls Online/live(eu)/AddOns

/live(eu) means : "live" for NA or "liveeu" for EU.


Code:

local OrgZO_LinkHandler_CreateChatLink = ZO_LinkHandler_CreateChatLink
ZO_LinkHandler_CreateChatLink = function(linkFunction,...)
                        if linkFunction == GetSmithingPatternResultLink then
                          pat,mat,qtt,style,trait = ...
                          return GetSmithingPatternResultLink(pat,mat,qtt,style,trait,LINK_STYLE_BRACKETS)
                        end
                        return OrgZO_LinkHandler_CreateChatLink(linkFunction,...)
                        end

seems to work for the station and and items in the bag. should be OK

votan 03/14/16 03:10 PM

Quote:

Originally Posted by Wandamey (Post 26462)
The error when you link is not from the addons.
It's the same cause, but we can't do anything about it on our own.

Just wait and avoid linking from the gear crafting stations :o

Edit: well maybe we could rewrite the function in cause in a mini-patch


try to paste this at the top of any addon main .lua file (!!only once, or better, wait for the patch addon to be updated... maybe with a link here soon)

Code:

local OrgZO_LinkHandler_CreateChatLink = ZO_LinkHandler_CreateChatLink
ZO_LinkHandler_CreateChatLink = function(linkFunction,...)
                        if linkFunction == GetSmithingPatternResultLink then
                          pat,mat,qtt,style,trait = ...
                          return GetSmithingPatternResultLink(pat,mat,qtt,style,trait,LINK_STYLE_BRACKETS)
                        end
                        return OrgZO_LinkHandler_CreateChatLink(linkFunction,...)
                        end

seems to work for the station and and items in the bag. should be OK

I added this fix in here merBandAidZouiFixes.zip


All times are GMT -6. The time now is 11:46 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI