Reading commodity prices
Moderators: winston, another_commander
Reading commodity prices
Hello!
I have been browsing the Javascript reference for a while but I can't seem to see anything for reading commodity prices. I want to read the commodity prices for the whole galaxy - or if that's too slow, perhaps just all the commodity prices within one or two jumps.
How do you do that?
Les
I have been browsing the Javascript reference for a while but I can't seem to see anything for reading commodity prices. I want to read the commodity prices for the whole galaxy - or if that's too slow, perhaps just all the commodity prices within one or two jumps.
How do you do that?
Les
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
You can't I don't think.
1) Gameplay wise - canon/handwavium - no system is allowed to transmit its prices beyond its own borders.
2) Code wise - Each system is created pseudorandomly at the moment you jump in to it - before that moment - there is no commodity price list...
1) Gameplay wise - canon/handwavium - no system is allowed to transmit its prices beyond its own borders.
2) Code wise - Each system is created pseudorandomly at the moment you jump in to it - before that moment - there is no commodity price list...
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
DH is correct. Commodity information is not exposed to javascript at this time.
Find my OXP's at:
Deep Horizon Industries - Your Planet Our Design
Deep Horizon Industries - Your Planet Our Design
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
You know - all my code knowledge is obtained purely by osmosis via these forums from you guys - I'm sure I supposed to be remembering important stuff instead...Cmd. Cheyd wrote:DH is correct. Commodity information is not exposed to javascript at this time.
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Reading commodity prices
On the wiki page about commodities.plist is explained how prices are calculated. You will see that is contains a random number. That means that even when you would calculate a correct value for the adjacent system, the market will have changed by the time you arrived there. So even when it would be possible, it would be useless.lesliev wrote:Hello!
I have been browsing the Javascript reference for a while but I can't seem to see anything for reading commodity prices. I want to read the commodity prices for the whole galaxy - or if that's too slow, perhaps just all the commodity prices within one or two jumps.
How do you do that?
Les
You can compare it with the calculation of the tomorrows values of earths commodity market: A lot of people would pay good money when you would find an accurate formula to do that
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Reading commodity prices
First of all, hello and welcome to the boards!lesliev wrote:Hello!
I have been browsing the Javascript reference for a while but I can't seem to see anything for reading commodity prices.
You have been unlucky with the Javascript reference, because commodity prices are not in the realm of JavaScript. They are calculated via a plist, and—as the other guys already said—ae calculated only the very moment the player jumps into a system. Therefore no commodity prices for adjacent systems (or the whole galaxy) ever exist.
The documentation is here: http://wiki.alioth.net/index.php/Commodities.plist
And for everything else which isn't related to JavaScript you will find links to the documentation on the Oolite Scripting category page: http://wiki.alioth.net/index.php/Catego ... _scripting
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Market prices never stayed the same in the original Elite (at least not in the versions I used to play: C64 and Atari ST). They were subject to random just like in Oolite—which is at its core a faithful recreation of Elite.lesliev wrote:I did see the Commodities.plist wiki entry but assumed MARKET_RND was random with a fixed seed so that market prices stayed the same for each system - like in the original Elite.
No, not generally. Only where certain entries of the dictionaries have been exposed to JS.lesliev wrote:I assume Javascript can't read the plist dictionaries after they have been loaded by Oolite?
You could of course file a request for exposing the current system's data in either the System or the Station class, or probably in the SystemInfo class.
The version I used to play was the CGA PC version, and later Elite Plus on the PC. There were buying and selling prices for each commodity, not just one price. And the prices always stayed the same for a system. I downloaded Elite Plus again to check.
Back in the DOS days I wrote a program which allowed me to type in the market prices for many of the systems and then calculate optimum trading routes.
Probably a year ago I downloaded the source for Oolite and hacked a lesser "trading computer" into the game - just something to show ((price - average) * cargo_bay_size) next to each commodity. I was thinking of trying to write a few "trading computer" OXP's.
Back in the DOS days I wrote a program which allowed me to type in the market prices for many of the systems and then calculate optimum trading routes.
Probably a year ago I downloaded the source for Oolite and hacked a lesser "trading computer" into the game - just something to show ((price - average) * cargo_bay_size) next to each commodity. I was thinking of trying to write a few "trading computer" OXP's.
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
That's not Elite, but a rather fundamental aberration from Elite.lesliev wrote:The version I used to play was the CGA PC version, and later Elite Plus on the PC. There were buying and selling prices for each commodity, not just one price.
We are always happy to welcome a new scripter with new ideas!lesliev wrote:Probably a year ago I downloaded the source for Oolite and hacked a lesser "trading computer" into the game - just something to show ((price - average) * cargo_bay_size) next to each commodity. I was thinking of trying to write a few "trading computer" OXP's.
However, due to the sometimes rather high fluctuation of prices I doubt the usefulness of calculating the current price against the average. You've already dug into commodities.plist, so you know that also the system economy plays an important role (the average price for any commodity in a rich industrial is very much different from the average price for the same commodity in a poor agricultural). And that doesn't even take into account non-main stations which may (and often do) offer completely different prices and therefore much bigger profit rates.
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Hi Les and welcome.
The commodity prices in Elite Plus were always a bit strange (a bug?… and not the only one, I hated the joystick bug).
I just booted up my old 3.5 floppy of EP, and actually found my old save games, which I’d given up ever finding… thanks for that. The game moves so fast, and uses 50% of processor power (of course, that’s not in an emulator), compared to 6% for Oolite. A little trip down memory lane, with an old Archangel commander.
The commodity prices in Elite Plus were always a bit strange (a bug?… and not the only one, I hated the joystick bug).
I just booted up my old 3.5 floppy of EP, and actually found my old save games, which I’d given up ever finding… thanks for that. The game moves so fast, and uses 50% of processor power (of course, that’s not in an emulator), compared to 6% for Oolite. A little trip down memory lane, with an old Archangel commander.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!