Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

AI Trading Assistant

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2321
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: AI Trading Assistant

Post by Wildeblood »

richard.a.p.smith wrote:
I got rid of Yoda (nice bit of fun, though!) to simplify things but before doing that did move him from managed to add-ons as suggested. I didn't notice any change, though, what should have differed?
There are just a few text strings - five I think - that are in missiontext.plist, not in javascript. So it depends on the load order of the OXZs which version is used. The managed OXZ should work on Windows where load order is alphabetical, but it is unreliable on Linux/Mac. The opportunity cost message is one: "Sixth station you've visited with x, this is." The starting messages are also affected.
richard.a.p.smith wrote:
I have had a couple of cargo contracts and for the first few left it just giving advice. After a while I thought I'd see how it worked with contracts. I had gold and/or platinum and gem-stones contracts. I shot up some ships and picked up additional gold and/or platinum and gem-stones and watched what happened when going to f8 after docking. It did the gold or platinum and left 4030 kg after selling 11 kg so from that determined that it was interacting okay with contracts.
Yay! This is the response I've been waiting to receive from someone. Thanks, Richard.
richard.a.p.smith wrote:
It then went to gem-stones and sold 127 g without noticing the contract so I had to buy some back. Observing the various AI display options it occurred to me that it might be related to the other problem but I cant' really be specific about that, just the gold/platinum and gem-stones entries were a bit different (one maybe had an entry for number of docks but the other didn't, something like that).
Boo! For a long time it wouldn't ever sell gemstones, they being excluded from management. I hope I didn't miss something when I included them. Perhaps there'll be another plug-in, AI Trading Show Contracts, the next time I have the time and mood to tackle this.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2321
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Contracted Goods Reminder

Post by Wildeblood »

Norby asks me whether this code still works okay in 1.82 - he opines it should - but I can't answer him because I have no idea. Does anyone care to offer any insight?

Code: Select all

this.name    = "Contracted Goods Reminder";
this.version = "1.0";

    this.guiScreenChanged = function (to, from) {
        "use strict";
        if (player.ship.docked &&
            to === "GUI_SCREEN_MARKET") {
            this._reserveGoodsForContracts();
        }
    }

    this._reserveGoodsForContracts = function () {
        "use strict";
        this.$reservedGoods = {};
        var arrayLength = player.ship.contracts.length;
        if (arrayLength) {
            for (var i = 0; i < arrayLength; i++) {
                var commodity = player.ship.contracts[i].commodity;
                var quantity  = player.ship.contracts[i].quantity;
                var reserve   = this.$reservedGoods[commodity];
                if (reserve) {
                    this.$reservedGoods[commodity] += quantity;
                } else {
                    this.$reservedGoods[commodity] = quantity;
                }
            }
        }
    }

    this.playerSoldCargo = function (commodity, quantity, unitPrice) {
        "use strict";
        var panic = false;
        var reserve = this.$reservedGoods[commodity];
        if (reserve && !manifest[commodity]) {
            panic = true;
        } else if (reserve && reserve > manifest[commodity]) {
            panic = true;
        }
        if (panic) {
            var displayName = displayNameForCommodity(commodity);
            player.consoleMessage("You need at least " + reserve + " units of " + displayName.toLowerCase() + " to fulfil your contracts.", 5);
        }
    }
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: AI Trading Assistant

Post by cim »

I don't see any reason it wouldn't. There are more options - in theory at least - for what the value of commodity is, but the code doesn't rely on it having any particular value.
User avatar
Mazur
Dangerous
Dangerous
Posts: 110
Joined: Thu Jun 04, 2015 7:53 pm

Re: AI Trading Assistant

Post by Mazur »

Just to test it out, I manually installed AI Trading Assistant in my Oolite 1.82 Linux, today I reached the point where I could afford it, so I bought it, and it gave what I considered weird advice, like buying 1 computer TC in a low ag system, when I'd just brought in 30 TC of them, and selling the 30 Furs TC I'd just bought for Xexedi. After two or three trips trips with it, it was time to eat something, I saved my game in Laenin, and when I came back, it was not even installed in my ship anymore. I do have a lot of gear installed, no idea if there is a limit, see snapshot below:
My Commander is named Vatta, and this is his Cobra.
User Mazur, Commander Vatta, Hyperspace Delivery Boy.
Squeaky clean, utterly harmless, rank amateur.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2321
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: AI Trading Assistant

Post by Wildeblood »

Mazur wrote:
Just to test it out, I manually installed AI Trading Assistant in my Oolite 1.82 Linux...
How did you manage to do that? It's not compatible with 1.82 because the market system has completely changed from Oolite 1.80 to 1.82. The manifest in AI Trading Assistant should prevent it loading into Oolite 1.82.

If you have a look in your Latest.log file it should have a note saying that the OXZ wasn't loaded.
User avatar
Mazur
Dangerous
Dangerous
Posts: 110
Joined: Thu Jun 04, 2015 7:53 pm

Re: AI Trading Assistant

Post by Mazur »

Wildeblood wrote:
Mazur wrote:
Just to test it out, I manually installed AI Trading Assistant in my Oolite 1.82 Linux...
How did you manage to do that? It's not compatible with 1.82 because the market system has completely changed from Oolite 1.80 to 1.82. The manifest in AI Trading Assistant should prevent it loading into Oolite 1.82.

If you have a look in your Latest.log file it should have a note saying that the OXZ wasn't loaded.
Nope. Nothing about not being able to load AI trading assistant. I think I just downloaded and unzipped it, like all the billion packs I installed from within the program. And it showed up on a few High Tech stations.

It's not available through the program itself, and I figured it would not work right, but I knew nothing about Oolite yet, except that I wanteds to plays itssss. :gollum: And I reckoned I needed assistance in figuring how best to trade, not knowing yet that it's quite simple: figure how much more per TC you get on arrival and fill yer ship with the greatest increase per TC, apart from the standard 5 boxes of pirate kibble. It might be a nice idea, if feasible, to designate food as such and not complain about the trading loss in keeping that around for jump after jump.

Another thing that went wrong was, it didn't change the HUD back to the space faring one after lu(a)nch. But I guess you know that already.
User Mazur, Commander Vatta, Hyperspace Delivery Boy.
Squeaky clean, utterly harmless, rank amateur.
Duggan
---- E L I T E ----
---- E L I T E ----
Posts: 496
Joined: Sat Dec 31, 2011 2:58 pm

Re: AI Trading Assistant

Post by Duggan »

I have always found this Add on particularly helpful in aiding my trading. However another Add on that I have installed (FuelRecovery 1.03 oxp) requires that I keep a hold of some Radioactives to make Fuel Recovery possible.

I like that Autotrade FAST allows me not to think, I also like that FuelRecovery allows me to reclaim a dribble of quirium in flight.

I wondered then.. Is there any way in my AI trading assistant, I could edit it to neglegt radioactives as it does illicit cargo ?

I am running an older set of Autotrader so I do have access to the code.

I am thinking it may be an edit I can do to AI Trading Ethical Trader 2.4 oxp ,which I run in addition to ;
AI Trading Assistant 2.6.2 oxp along with, AI Trading,My Advisor 2.2.6 oxp.

edit I might have cracked it . In my AI Ethical Trader jscript I edited it so that Radioactives have a value of 0 (same as the other illicit commodities). If this has resolved the issue I at least had really nice chat with myself :roll:
Flying Python Class Cruiser, Chapter & Verse IV
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2321
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: AI Trading Assistant

Post by Wildeblood »

Duggan wrote:
I am running an older set of Autotrader so I do have access to the code.

I am thinking it may be an edit I can do to AI Trading Ethical Trader 2.4 oxp ,which I run in addition to ;
AI Trading Assistant 2.6.2 oxp along with, AI Trading,My Advisor 2.2.6 oxp.
[Shudder.] Please update to version 2.15.1, link on previous page IIRC. I take it you're still using Oolite 1.80? AI Trading Assistant will never be compatible with Oolite 1.82 or later.*

Ethical trading was merged into the main Autotrade script long ago, but a similar edit to what you have done is still possible. It might also be possible to edit the function that reserves cargo for contract deliveries (which is similar to that code posted above), to reserve some radioactives but still trade them automatically.

* Autotrade could be updated to make it compatible with current Oolite - it still functions independently of the rest of the OXZ - but I won't be bothering to do it.
"Would somebody stop that bloody music!"
Duggan
---- E L I T E ----
---- E L I T E ----
Posts: 496
Joined: Sat Dec 31, 2011 2:58 pm

Re: AI Trading Assistant

Post by Duggan »

I take it you're still using Oolite 1.80? AI Trading Assistant will never be compatible with Oolite 1.82 or later.*
This older Version works in Oolite 1.82 Adequately :) So perhaps my antiquated outdated version was forward compatible where as the newer release was well..err not so future proof. I don't know , but it works with 1.82 and it has not broke my game as yet .
Flying Python Class Cruiser, Chapter & Verse IV
paul_c
Above Average
Above Average
Posts: 17
Joined: Sun Nov 29, 2015 2:43 pm

Re: AI Trading Assistant

Post by paul_c »

I've just installed it (running 1.82), did a few planets, but now removed it. I've not read the first 10 pages of the thread, but its basis for how it recommends stuff doesn't seem right!!!!

For example, if I go to a poor ag planet, then rich ag, then rich ind, I'd want to buy all the furs, liquor, food and textiles at the first; but then sell textiles and food at the next, to clear space in the cargo hold for more furs and liquor. Price above/below average isn't the metric to determine the viability of a trade - its the potential profit at the next or next-but-one planet!!! So, in my above, I'd trade something very marginally between poor ag and rich ag, simply because there's hold space. But then get rid of the marginal stuff and replace it with something more profitable for the next run. Basically, you need to evaluate everything in the cargo bay and everything for sale (including the quantity-----with a big 175t hold, you can buy all on offer of eg furs but not fill the hold), to see if the space created by trading marginally, had more "opportunity cost".

Also don't forget that you can't physically sell more than 127t, so there's no point carrying eg 140t furs, you may as well carry 127t of them and 13t of the next-most-profitable item. And if the next planet has some of that commodity, you can sell only to bring their amount up to 127t. Sometimes you need to take a guess at what's going to be possible to sell at the next (or next but one....if you have the space to keep it and still trade profitably on the current run).

Also it wants you to sell gold/plat/gems just because they're above average - you'd buy at above average price....and ONLY sell at top price, since there's no (ok well...there is..if you have more than 499kg) hold space penalty.

I'm sure its advice is sound for milk runs with a Cobra, but the bigger ship, longer runs, combining inter-planetary trading with a bunch of contracts etc.....Also I think it advises against selling the reserved stuff on a contract.....you CAN sell it! You can use it to trade with...all you need to do is buy enough of it before you make it to the next planet to fulful the contract, or be prepared to break the contract (possibly to enable fulfilling a bigger contract....etc).
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2321
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: AI Trading Assistant

Post by Wildeblood »

paul_c wrote:
I've just installed it (running 1.82), did a few planets, but now removed it. I've not read the first 10 pages of the thread...
You didn't even read the last few messages on this page. And like Mazur before you, you've deliberately circumvented the compatibility checks to install something that is clearly not compatible with current Oolite 1.82, and well-known to be not compatible, just so that you can have an excuse to come here and tell me that you're cleverer than me.

You're wrong in what you say, but I'm not going to waste my time explaining to you why you're wrong. Since you're so clever, you can figure it out for yourself. Fuck off, cunt.

Moderators, how about locking this topic? I've said quite clearly I've no intention of updating this OXP for Oolite 1.82, and I've also no intention of playing with trolls.
"Would somebody stop that bloody music!"
paul_c
Above Average
Above Average
Posts: 17
Joined: Sun Nov 29, 2015 2:43 pm

Re: AI Trading Assistant

Post by paul_c »

Wildeblood wrote:
paul_c wrote:
I've just installed it (running 1.82), did a few planets, but now removed it. I've not read the first 10 pages of the thread...
You didn't even read the last few messages on this page. And like Mazur before you, you've deliberately circumvented the compatibility checks to install something that is clearly not compatible with current Oolite 1.82, and well-known to be not compatible, just so that you can have an excuse to come here and tell me that you're cleverer than me.

You're wrong in what you say, but I'm not going to waste my time explaining to you why you're wrong. Since you're so clever, you can figure it out for yourself. Fuck off, cunt.

Moderators, how about locking this topic? I've said quite clearly I've no intention of updating this OXP for Oolite 1.82, and I've also no intention of playing with trolls.
I read the wiki, assumed that since it was for 1.80, would work for 1.82, so I installed it. Then I read this thread and upon discovering that its not forwards compatible, removed it. I seem to have touched a raw nerve though?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6571
Joined: Wed Feb 28, 2007 7:54 am

Re: AI Trading Assistant

Post by another_commander »

@Wildeblood: How about you learn to behave a bit better in this forum? Thank you in advance for your cooperation.
Duggan
---- E L I T E ----
---- E L I T E ----
Posts: 496
Joined: Sat Dec 31, 2011 2:58 pm

Re: AI Trading Assistant

Post by Duggan »

I dunno , this OXP was retired and yet it's use seems beneficial as it takes all the hassle out of trading. The OXP was nuked by its developer as per the Owners perogative but I believe that there is something to be said for automatic trading (excluding illegal stocks) personally..perhaps another look by someone more gifted at coding than I is warranted..:)
Flying Python Class Cruiser, Chapter & Verse IV
User avatar
Cholmondely
Archivist
Archivist
Posts: 5128
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: AI Trading Assistant

Post by Cholmondely »

Wildeblood wrote: Sun Dec 20, 2015 5:14 pm
I've said quite clearly I've no intention of updating this OXP for Oolite 1.82
Analysis

For those of us who experiment with v.1.77.1 etc.

what exactly are the various different members of this horde?

We currently have:

AI Trading Assistant 2.15.1
AI Trading Autotrade Report 0.5.3
AI Trading Backup Datalogger 2.12.3
AI Trading Legality Reminder 1.0
AI Trading Purchase Book 2.12
AI Trading Turbotrader 1.0
AI Trading with Yoda 1.0

Are they just all retitled versions of the same thing?





Synthesis

Another point which strikes me is the provision of a possible answer to the mystery of the missing crew-members (up to 72! on an Anaconda).

If updated for current versions of Oolite, this could provide vital in-game dialogue displaying the existence of your crew.

A Legal Advisor for commodity trading (who also specialises in legal small print for contracts, with suitable comments when one buys or sells something: "Hold off a minute, sir, I just need to complete subsection #3789546b before you can sell this! And you will need to sign right here. Oh! And what was your grandmother's middle name again?")

An accountant (combinable with the Ship's Accountant OXP): "No! No!! No!!! You must not buy that number of them. According to the seventh dialectical amphiboly of the Theological Arithmetics of Saint Phibo Nacci, you will be sempiternally cursed by the Witchspace Lobster. Buying one less should do it"

A purchase booker: "Are you quite sure that you want 100 of them? There are only two columns for those in the purchase book. 99 would be much easier"

A backup datalogger: "Stop! Don't do anything for another couple of minutes! I'm busy backing up and can't handle any more input. I just can't turn the crank any faster..."

A Yoda: what is a Yoda? What do they do? Cousin Digby never had one, and neither did dear papa. Araminta has never heard of one, and Benedict just gives me a dirty look. Does it glow in the dark? Or bounce when you drop it?



And if one had to respond to each (clicking on a dialogue button or some such), the player would enjoy all the thrills and joys of managing such a large crew. How blissfully immersive!

You might just have provided a solution to the biggest-by-far problem with Oolite.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply