EDIT 4:
If you have not yet read this post, don't !
Instead read the post below, which is shorter and hopefully better formatted, too.
Greetings.
Since I'm both patient and like the price import to be easy to use and all in one place, I decided to salvage "MTG Mint Card.lua" for my first attempt at lua
I've asked my FLG (friendly local gameshop) where they get their reference prices from and luckily the site's html is both nicely grepable and includes out-of-stock prices (I'll withhold both my script and the shops identity until I've received their OK, but I decided to wait with asking until I gathered all inconsistencies my script will identify in their database, in the hopes that it will persuade them they'll gain something from it).
The script is progressing nicely so far, and a few questions have cropped up:
Most importantly: Would
Goblin Hero be so kind as to provide a list of and documentation for all functions that ma provides ? From this thread, "MTG Mint Cards.lua" and "Import Prices.lua" I gathered:
ma.SetPrice(InternalSetID, CardLanguage, CardName, CardVersion, RegularPriceValue, FoilPriceValue) [setting 0 to a card value tells the ma app no value]
Q: return value is the number of cards set ?
RFE: can SetPrice get a second return value to report whether an existing price was overwritten ? Alternatively, or actually preferred: can we get a ReadPrice function ? The shop lists "[card] (light played)" for older editions, and I want my script to use those as fallback if no other price is available.
Q: What character encoding is expected ? Due to CardName being apparently matched against the OracleName field, I got around lots of problems by
- Code: Select all
name = string.gsub(name, "Æ", "AE")
name = string.gsub(name, "û", "u")
name = string.gsub(name, "á", "a")
name = string.gsub(name, "â", "a")
but
Junún Efreet is officially using the accented u, and setting my script file's encoding from utf-8 to ansi did not help.
ma.GetURL() <- Fetches URL and Returns TextDump of Webpage
ma.Log(Message) <- Writes information into the ma log. [Not exactly global logging since the data isnt stored any were for future processing]
ma.SetPBar(Progressmessage, NumericalProgress)
Q: was documented in the thread, but does not exists, I assume it got renamed to:
ma.SetProgress(Progressmessage, NumericalProgress)
Q: I see the bar update and fill quite fine, but don't find pmesg displayed anywhere.
ma.GetFile (filename)
I guess this is the local equivalent of GetURL ?
EDIT:
RFE: Can we get more get[field] functions ? getOraclename(InternalSetID, CardLanguage, CardName, CardVersion) would make importing the Revised Limited German set much easier (provided äÄöÖüÜß encodings will work out), instead of having to add every single card to the namereplace table.
RFE: Can we get a function to write data to a file, apart from the volatile ma.Log ? I think it might help to have the script write itself partially by generating one half of the namereplacement table
. Besides, I'm not sure that a giant table kept in memory would be a good idea to implement checking for duplicates while setting the prices.
EDIT2:
Does someone have an idea why SetPrice returns 0 for "
Liliana of the Dark Realms Emblem", but afterwards the price is set in the database ? Are my assumptions on SetPrice's return value wrong ?
EDIT3:
Ignore edit2... not finding the GER overwrote the retval "1" from setting the ENG... need to rething my handling of setting both languages at once