Quantcast Looking for a bone: help with trading house rules - ESOUI
Thread Tools Display Modes
05/04/18, 09:15 AM   #1
Lunaugh
Join Date: May 2018
Posts: 8
Looking for a bone: help with trading house rules

Greetings code crunching fanatics and lurkers alike,
I'm inspired by Master Merchant and Tamriel Trade Centre, but I find that in exploring their code, it is not as simple as cannibalizing functions to build my own (currently private) add-on.

I've come to the conclusion that I should start fresh, though I've taken as many lessons as I could from the above add-ons raw lua.

I want to use the following functions, but I don't know what conditions (if any) are required for the function to... function:
GetNumTradingHouseGuilds()
GetTradingHouseGuildDetails()
GetNumGuilds()
GetGuildID()
GetGuildName()
SelectTradingHouseGuildid ()
RequestTradingHouseListings()
GetNumTradingHouseListings()
GetTradingHouseListingItemInfo()

If someone would be so kind as to help me understand the pre-reqs I'd be very appreciative;
currently I'm writing the code without using events; I plan on using /'addonName' 'function' 'var1' 'var2' to activate my various functions in game.

A little background: I'm self taught in Python and Lua, my first attempt to write an add on was to write it in Python, then make my .py file required by lua so I didn't have to learn lua.......... in the process I wound up learning enough about lua to realize that I'd be re-building the entire api (blindly) to make one add-on that may or may not function AND needs a lua file interpreter.
When I am confident in my abilities, I plan on making add-ons for public consumption.

Tl;dr
Please help!
  Reply With Quote
05/04/18, 10:21 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,101
Welcome to ESOUI, Lunaugh!
Addons like Master Merchant and Tamriel Trade Center are huge and complicated projects and a bad choice for trying to break into making addons for ESO. You are better advised to look at our Getting Started guide on the wiki, do some of the tutorials and build a simple addon first, before you try anything overly ambitious just to get frustrated and quit half-way through.

As for the functions, you can find the arguments and return values on the wiki or in the ESOUIDocumentation.txt attached to the API patch notes on the official forum. In order to understand how the game itself uses them, you can read the source code of the UI over on github.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote
05/04/18, 10:34 AM   #3
Lunaugh
Join Date: May 2018
Posts: 8
I appreciate your concerns.
I am however, of the Undaunted.

Tamriel Trade Center and Master Merchent are indeed vet-dungeons and I'm non-champion point lvl 20 wandering in.

I will not, however, change my ambitious goal.
I need to strive for the advanced, because I want the advanced.
I've been trolling the wiki for some of the API commands, but I didn't know there was another page that would help me identify when to trigger certain functions.

When I began coding, it was specifically because I wanted to take the data that tamriel trade center collects and import it to an excel file: https://forums.elderscrollsonline.co...ta-dump#latest
Not finding what I wanted, I resolved to create my own. I've gone from zero coding experience to manipulating xlsx files with python openpyxl; I now have Visual Studio, SQL and a few other DYI coding applications.

tl;dr
thanks for your help! I won't take your advice regarding MM and TTC.

P.S. your signature just ran a while-loop on me:
function checkForTypo (text)
do -------
end
counter = 0
while counter ~=5
do checkForTypo (sirinsidiator's signature)
counter = counter + 1
end

P.P.S.:
what is the difference between zos term 'gamepad' and 'keyboard'?

Last edited by Lunaugh : 05/04/18 at 11:48 AM. Reason: Forgot to end
  Reply With Quote
05/04/18, 01:53 PM   #4
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 434
Basically, you look at what a function needs and you look at another function to provide what you need that doesn't need anything/as much.

For example, you want all of your guild names?

You use GetGuildName() but you need to know how many guilds you have, so you use GetNumGuilds()

Now that you know you have X guilds, you can loop through each one and get the name.

GetGuildId() does exist, which takes an index and returns which guild it is for you. Someone else might know, but for me the ID is always identical to the index.

Now some functions you have to use some common sense, like SelectTradingHouseGuildid()
That function will choose which trading house you're currently viewing. Obviously you can't call it just anywhere and have it magically open, so you have to assume you have to be in a guild store at the bank. So if you open the guild store and call it with a value of 1,2, etc. you'll see your active guild store change.
  Reply With Quote
05/04/18, 06:01 PM   #5
ziggr
 
ziggr's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 15
Originally Posted by Lunaugh View Post
When I began coding, it was specifically because I wanted to take the data that tamriel trade center collects and import it to an excel file
Minimize the number of puzzles you need to solve at once, focus on what's essential: read Tamriel Trade Centre data and export it as an Excel spreadsheet (aka a text file, either comma-separated or tab separated).

You don't need to write an add-on to do that. Just a stand-alone script that loads SavedVariables/TamrielTradeCentre.lua and then uses the data stored in that file to populate a text file.

Then the only puzzles you're left with are
* how to write a stand-alone Lua script
* that can read a SavedVariables file
* and write a text file
* and understands whatever format/table/arrangement is within that SavedVariables

--Z
  Reply With Quote
05/06/18, 04:32 PM   #6
Lunaugh
Join Date: May 2018
Posts: 8
Alright, new question:

how should I call this function?
Do I use a while loop for the index and a 'if ~= nil' break?
what is fn?

function ZO_TradingHouse_CreateItemData(index, fn)
local icon, name, quality, stackCount, sellerName, timeRemaining, purchasePrice, currencyType = fn(index)
if(name ~= "" and stackCount > 0) then
local result =
{
slotIndex = index,
icon = icon,
name = name,
quality = quality,
stackCount = stackCount,
sellerName = sellerName,
timeRemaining = timeRemaining,
purchasePrice = purchasePrice,
currencyType = currencyType or CURT_MONEY
}

return result
end
end


this is my current attempt:
ztuffedHause = {}
eggTimer =0

while eggTimer <9999999999999999
if ZO_TradingHouse_CreateItemData(eggTimer, fn) == nil and eggTimer < 1 do
eggTimer = eggTimer+1

elseif ZO_TradingHouse_CreateItemData(eggTimer, fn) ~= nil do
table.insert (ztuffedHause, ZO_TradingHouse_CreateItemData(eggTimer, fn))
eggTimer = eggTimer+1
else break
end
end
end

Last edited by Lunaugh : 05/06/18 at 05:05 PM.
  Reply With Quote
05/06/18, 04:34 PM   #7
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 434
GetTradingHouseSearchResultItemInfo and GetTradingHouseListingItemInfo
  Reply With Quote
05/06/18, 08:11 PM   #8
Lunaugh
Join Date: May 2018
Posts: 8
I'm not sure I understand your answer, can you elaborate or use an example?

Edit: I see, those are the 'fn' variables. Thank yoU!

Last edited by Lunaugh : 05/06/18 at 08:20 PM.
  Reply With Quote
05/09/18, 01:29 PM   #9
calia1120
 
calia1120's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 60
Thurisaz Guild Info works with some of the data you're trying to grab. Take a look at the files in the guild subfolder of the addon - scanner and history in particular. http://www.esoui.com/downloads/info8...GuildInfo.html
__________________
Calia | @Calia1120 | NA Server
GM, Iron Bank of Bravos | Council of Nirn | Elder Scrolls Alliance
My Addons
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Looking for a bone: help with trading house rules

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off