RFC: script access to station markets
Posted: Sun Oct 07, 2012 4:45 pm
One thing that I've seen requested a few times over the last couple of years is access from script to station market data (and to commodity.plist definitions). This isn't particularly tricky to do, but there has been some controversy in previous threads about whether it's a good idea.
My planned implementation is:
Read:
Write:
Opinions on the desirability of doing this, any limitations that should be placed on access, and the proposed API, please.
My planned implementation is:
Read:
station.market
- returns an object, with keys as the internal commodity names, and values as an array representing the commodity.plist line for that station and commodity (note that this will put the current quantity and price into elements 1 and 2 of the array). So, for instance, station.market.food
might be ["Food", 17, 40, "19", "-2", "-2", "6", "1", "1", "0"]
at Lave.Write:
station.setMarketPrice(commodity,price)
and station.setMarketQuantity(commodity,quantity)
, which do what you'd expect. The price must be between 0 and 1020 decicredits (should it be forced to a multiple of 4 too?), and the quantity between 0 and 127 units.Opinions on the desirability of doing this, any limitations that should be placed on access, and the proposed API, please.