ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Patch 1.3.3 Item Link handling (https://www.esoui.com/forums/showthread.php?t=2054)

Khaibit 08/04/14 11:01 AM

Patch 1.3.3 Item Link handling
 
Well, my addon was working fine on the PTS, but it appears they've yet again changed something between the PTS build and the live build. Previously, this worked:

Code:

-- assume we have a Button called someButton, and an item link called itemLink
someButton:SetText(itemLink)

However, now, the item names are mostly lowercased (except for a few items, with no commonality that I can determine) and retain the ^n ^p and whatnot at the end (again, most of the time, the ones that show proper title casing do not display the control characters either). The chat box, on the other hand, parses them correctly still; this still works the same as it did before:

Code:

ZO_ChatWindowTextEntryEditBox:SetText(itemLink)
Ugh. So...what is the 'proper' way to parse the links now? This seems to strip out the control characters, but leaves the name all lowercase; is there a good way to title-case the result?

Code:

local testName = zo_strformat("<<1>>", itemLink)
someButton:SetText(testName)


Edit for clarity and so people don't have to read the whole thread if they don't want to: The following adjustment to the first code snippet fixes this:

Code:

-- assume we have a Button called someButton, and an item link called itemLink
someButton:SetText(zo_strformat("<<t:1>>", itemLink))


merlight 08/04/14 11:09 AM

You seem to be using old links from before 1.2.3, otherwise you wouldn't have had any text to strip control characters off. You should either convert or get rid of those.

Back when item links contained item name, I used this:
Lua Code:
  1. local function PrettyItemLink(link)                        
  2.     return link and zo_strformat(SI_TOOLTIP_ITEM_NAME, link)
  3. end

Garkin 08/04/14 11:12 AM

http://www.esoui.com/forums/showpost...84&postcount=4

Khaibit 08/04/14 11:20 AM

Quote:

Originally Posted by Garkin (Post 11117)

Interesting, all of these are actually links pulled directly from the Guild Store sales history as of this morning - no old data being used. I will continue poking, however! This code was working 100% yesterday, so I'm not certain it's old links because none existed.

Edit: A very-stripped-down example that produces this behavior (displaying the first 20 because not all items have the control characters appended; enchanting runes for example do not, but finished glyphs do):

Code:

RequestGuildHistoryCategoryNewest(1, GUILD_HISTORY_SALES)
for i=1, 20 do
  local _, _, _, _, _, itemName, _ = GetGuildEventInfo(1, GUILD_HISTORY_SALES, i)
  d(itemName)
end

For now I'm going to use zo_strformat to strip the control characters, but I'd really like items to be properly title-cased again because the mix of some being all lowercase and some being titlecased with little rhyme or reason is rather ugly :) It also appears they fixed GetDisplayName() on the live build, without it ever being fixed on the PTS, so that's an entirely NEW bag of worms for all addon authors as yet again, all settings will be lost without manually editing SavedVars files. Grr...

Beost 08/04/14 11:33 AM

UI ERROR on 1.3.3
 
1 Attachment(s)
Since 1.3.3 Following UI Error pops up and cannot be dismissed
I loaded the screen shot as an attachment

Khaibit 08/04/14 11:37 AM

Actually...bloody hell. They changed the link format AGAIN - the name is included in the link. Just checked my savedvars after testing, and new items look like:

|H0:item:45211:52:50:26588:52:50:0:0:0:0:0:0:0:0:0:9:0:0:10000:0|hkresh breeches of stamina^p|h

I'm so confused. They added a GetItemLinkName function, but then added the name of the item back into the link? o_O Not that it helps my current situation, but I guess I can return to the old-style link parsing if the name is present in plain-text again.

Edit: Some additional fun - links that do not have the name embedded in them work fine, like they used to. New links pulled from the store since the patch, that contain the name, break things. I wonder if I can just do a gsub and remove the name :P

Garkin 08/04/14 11:37 AM

Quote:

Originally Posted by Beost (Post 11119)
Since 1.3.3 Following UI Error pops up and cannot be dismissed
I loaded the screen shot as an attachment

This does not have anything with this discussinon.

Anyway, Wykkyd is working on the fix, check addon comments:
http://www.esoui.com/downloads/info8....html#comments

If you don't want to wait for fix, just open file "mhFramework\Lib\Bazgrim\Toolbar\Bags.lua" and change line 15 from:
Lua Code:
  1. local icon, bagSlots = GetBagInfo(1)
to:
Lua Code:
  1. local bagSlots = GetBagSize(BAG_BACKPACK)

Garkin 08/04/14 11:41 AM

Quote:

Originally Posted by Khaibit (Post 11120)
Actually...bloody hell. They changed the link format AGAIN - the name is included in the link. Just checked my savedvars after testing, and new items look like:

|H0:item:45211:52:50:26588:52:50:0:0:0:0:0:0:0:0:0:9:0:0:10000:0|hkresh breeches of stamina^p|h

I'm so confused. They added a GetItemLinkName function, but then added the name of the item back into the link? o_O

Hm, I don't have NA client installed, so I can't test it. :/ But good to know, I can remove one more unnecessary function from Dustman code.

So GetItemLinkName(itemLink) does the same as zo_strformat("<<x:1>>", itemLink)?

Khaibit 08/04/14 11:49 AM

Quote:

Originally Posted by Garkin (Post 11122)
Hm, I don't have NA client installed, so I can't test it. :/ But good to know, I can remove one more unnecessary function from Dustman code.

So GetItemLinkName(itemLink) does the same as zo_strformat("<<x:1>>", itemLink)?

The former includes the control characters. The latter strips them. They both don't correctly title-case names though. Going to see what happens if I strip out the name via gsub and force them into the pre-Update 3 link format. ;)

Garkin 08/04/14 11:56 AM

Quote:

Originally Posted by Khaibit (Post 11124)
The former includes the control characters. The latter strips them. They both don't correctly title-case names though. Going to see what happens if I strip out the name via gsub and force them into the pre-Update 3 link format. ;)

This command should not capitalize any characters in name. If you want to make first letter of each word capital, you should use:
zo_strformat("<<t:1>>", text)
or
zo_strformat("<<T:1>>", text)

So if I want to get correctly formated item name from itemLink:
zo_strformat("<<tx:1>>", itemLink)

See more: http://www.esoui.com/forums/showthre...=7321#post7321

Khaibit 08/04/14 12:01 PM

Quote:

Originally Posted by Garkin (Post 11125)
This command should not capitalize any characters in name. If you want to make first letter of each word capital, you should use:
zo_strformat("<<t:1>>", text)
or
zo_strformat("<<T:1>>", text)

So if I want to get correctly formated item name from itemLink:
zo_strformat("<<tx:1>>", itemLink)

See more: http://www.esoui.com/forums/showthre...=7321#post7321

Ah, thanks for that - I wasn't totally clear on arguments for zo_strformat. That sounds a whole lot easier and not regressive :)

Edit: Just to follow up - zo_strformat("<<t:1>>", itemLink) correctly formats both pre-Update 3 and post-Update 3 links correctly as expected. Thanks again Garkin, you rock :)

Xrystal 08/04/14 01:47 PM

Sheesh, Glad I didn't assume that my addon changes were finished. Looks like I have to do another adjustment to the link code in my addon.

Quote:

Originally Posted by Khaibit (Post 11120)
Actually...bloody hell. They changed the link format AGAIN - the name is included in the link. Just checked my savedvars after testing, and new items look like:

|H0:item:45211:52:50:26588:52:50:0:0:0:0:0:0:0:0:0:9:0:0:10000:0|hkresh breeches of stamina^p|h

I'm so confused. They added a GetItemLinkName function, but then added the name of the item back into the link? o_O Not that it helps my current situation, but I guess I can return to the old-style link parsing if the name is present in plain-text again.

Edit: Some additional fun - links that do not have the name embedded in them work fine, like they used to. New links pulled from the store since the patch, that contain the name, break things. I wonder if I can just do a gsub and remove the name :P



All times are GMT -6. The time now is 05:38 PM.

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