ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Looking for a bone: help with trading house rules (https://www.esoui.com/forums/showthread.php?t=7755)

Lunaugh 05/04/18 09:15 AM

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!

sirinsidiator 05/04/18 10:21 AM

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.

Lunaugh 05/04/18 10:34 AM

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'?

Rhyono 05/04/18 01:53 PM

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.

ziggr 05/04/18 06:01 PM

Quote:

Originally Posted by Lunaugh (Post 34586)
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

Lunaugh 05/06/18 04:32 PM

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

Rhyono 05/06/18 04:34 PM

GetTradingHouseSearchResultItemInfo and GetTradingHouseListingItemInfo

Lunaugh 05/06/18 08:11 PM

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!

calia1120 05/09/18 01:29 PM

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


All times are GMT -6. The time now is 02:59 PM.

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