ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Perform Trading House Search (https://www.esoui.com/forums/showthread.php?t=10340)

rp12439_3 10/09/22 06:18 AM

Perform Trading House Search
 
Hi there,

I am trying to start a tradinghouse search after I "setText" the searchtext. As you can see below (the screenshot) the setText part is allready working. Now I just want to trigger the function "behind" the Start Search button.
I studied the tradinghouse lua files (and the xmls). The tradinghouse_shared.lua seams not to be easy :) But thats more for addons who want to be a new tradinghouse :)

Is there a possiblity to just start the search?

Thanks in advance!


Baertram 10/09/22 10:23 AM

Maybe this is the one function that the keybind calls? Check for the "Search" keybind what it does and what function it calls!
A good way to find it is to check the SI_* string constants via e.g. merTrochbug updated addon, type /tbug and switch to the Strings tab, the search for trading house or anything like the text shown at the trading house search starter keybind (e.g. "search" or "Start search") and in the results for anything like SI_TRADING_HOUSE* or similar.

Some of the SI constants can be found here
https://raw.githubusercontent.com/es...tedstrings.lua
too.

-> "Start Search", -- SI_TRADING_HOUSE_DO_SEARCH
looks promising!

If you have found the SI_* string constant you can search the esoui source code for it
https://github.com/esoui/esoui/searc...OUSE_DO_SEARCH
to find where the keybind might be defined, and that way you will find the callback function called by that keybind, which should be the "start the search now" function.

https://github.com/esoui/esoui/blob/...board.lua#L113

Code:

TRADING_HOUSE_SEARCH:DoSearch()

rp12439_3 10/09/22 11:05 AM

Thanks, i tried to search for the text before too and just found some places where the global var was used.
I did it again and I also found:

self.browseKeybindStripDescriptor =
{
alignment = KEYBIND_STRIP_ALIGN_CENTER,

-- Do Search
{
keybind = "UI_SHORTCUT_SECONDARY",
name = GetString(SI_TRADING_HOUSE_DO_SEARCH),

callback = function()
TRADING_HOUSE_SEARCH:DoSearch()
end,
},

the TRADING_HOUSE_SEARCH:DoSearch() did it. I not really good familar with callbacks. Thats why I did not found it in the first place :(

Thanks!

rp12439_3 10/09/22 11:10 AM

oh and good tip for the addon... have zgoo allready but this one was missind.. very helpful

Baertram 10/09/22 12:12 PM

The callback is the function called as you do something. At a keybind there is only one callback for "pressing the keybind".
At a dialog there could be a cancelCallback if you cancel the dialog and the other callback is for each dialog button (e.g. yes, no, etc.).
Event got a callback function too as the event fires, e.g. you loot an item -> register event to INVENTORY_SINGLE_SLOT_UPDATE -> your callback func registered for that event is called. Same for your starter event of the addon: EVENT_ADD_ON_LOADED -> your registered callback func fires -> your check if it was your addon that was loaded -> unregister the event callback again and call the needed code for your addon.

rp12439_3 10/09/22 02:36 PM

just for the search:

TRADING_HOUSE:SearchForItemLink(itemLink)

did the trick. With all filters set correctly and so on


All times are GMT -6. The time now is 03:27 PM.

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