MatchTradingHouseItemNames

From ESOUI Wiki

Jump to: navigation, search

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.

Contents

Arguments

nameSubstring
A piece of text. This function will begin a search for all items whose names contain the text.

Example

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

Notes

External links

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox