From ESOUI Wiki
This function takes a single string as an argument, and begins a case-insensitive search for all items whose names contain the string. The search does not complete immediately; rather, this function returns a numeric "match ID," and the caller must use an event to detect when the match is completed. Once the match is completed, the caller can query information about the matching items.
Once a search is in progress, you can cancel it early by calling CancelMatchTradingHouseItemNames.
Although the set of functions used to search item names is only used by the vanilla game in the guild store UI, and although they're named for the guild store ("trading house" internally), you can run a name search even outside of the guild store.
- A piece of text. This function will begin a search for all items whose names contain the text.
local function _onComplete(eventCode, matchID, numResults, backgroundDurationMS) d("Listing results...") local count = GetNumMatchTradingHouseItemNamesResults(matchID) -- you could also just use numResults for i = 1, count do local name, hash = GetMatchTradingHouseItemNamesResult(id, i) d(" - " .. name) end end EVENT_MANAGER:RegisterForEvent("MyExampleEvent", EVENT_MATCH_TRADING_HOUSE_ITEM_NAMES_COMPLETE, _onComplete) local searchText = "em" -- find all items whose names contain this, e.g. "emerald" if ZoUTF8StringLength(searchText) < GetMinLettersInTradingHouseItemNameForCurrentLanguage() then d("The search string is too short! No search was performed.") else local matchID = MatchTradingHouseItemNames("em") -- find all items whose names contain "em," e.g. "emerald" -- -- Storing the match ID in a variable allows you to cancel -- the search early if you need to. For example, if you're -- creating a textbox to allow the player to search for -- items by name, you may want to cancel the search if the -- player changes what's in the textbox. -- end
- Zenimax's scripts don't allow you to search using a name fragment that is fewer than GetMinLettersInTradingHouseItemNameForCurrentLanguage() characters long. They use ZoUTF8StringLength to check the length.
- It's not clear what items, if any, wouldn't be eligible for being returned in a match. The Lua code for the vanilla Guild Store doesn't do any filtering on match results, so if Zenimax chooses to omit certain items (e.g. because they are always non-tradeable, like the Outfit packages unlockable in the Jubilee event), then those omissions are done within the API backend.