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 »

From what you described earlier, I was expecting to see in the log an error, "Parse failed in ai_trading_interfaces.js" and maybe a line number where could be found a stray control character or something. It sounded like the other scripts were loading but the interfaces script (the ugly duckling of the family) was not, but according to that log all the scripts are successfully loaded.

I can only suggest to stick with it for a while and see what happens; unless you specifically want to try out Market Observer there's no reason to remove the Trading Assistant OXZ, it won't interfere with anything else. This will require the attention of smarter people than me.
User avatar
Marte
Competent
Competent
Posts: 32
Joined: Mon Jan 05, 2015 11:06 am

Re: AI Trading Assistant

Post by Marte »

No sweat. I've played around with the game and now I've found this clue in the log. :)

Code: Select all

15:54:20.585 [script.javaScript.exception.ooliteDefined]: ***** JavaScript exception (AI Trading Interfaces 2.12.3): Error: Station.setInterface: Invalid arguments ("docking_history") -- expected key [, definition]; if definition is set, 'title' property must be a non-empty string..
15:54:20.585 [script.javaScript.exception.ooliteDefined]:       /Users/Marte/Library/Application Support/Oolite/Managed AddOns/oolite.oxp.Wildeblood.ai_trading.oxz/Scripts/ai_trading_interfaces.js, line 24.
Gotcha?! ;)
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

AI Trading Assistant version 2.13.1

Post by Wildeblood »

Version 2.13.1 is now available from the OXZ manager.

Recent changes:

2.13.1 (January 8th, 2015)
(1) Docking history was broken on first run. It should now work correctly, even in the strange case of the ship not being docked at start.
(2) Clutching at straws, trying to resolve Marte's bug I can't reproduce. Something is going wrong with expandMissiontext() in ai_trading_interfaces.js.

2.13 (October 26th, 2014) Added export legality display mode, and retired the plug-in called AI Trading Legality Reminder.
User avatar
Marte
Competent
Competent
Posts: 32
Joined: Mon Jan 05, 2015 11:06 am

Re: AI Trading Assistant version 2.13.1

Post by Marte »

Wildeblood wrote:
Version 2.13.1 is now available from the OXZ manager.

Recent changes:

2.13.1 (January 8th, 2015)
(1) Docking history was broken on first run. It should now work correctly, even in the strange case of the ship not being docked at start.
(2) Clutching at straws, trying to resolve Marte's bug I can't reproduce. Something is going wrong with expandMissiontext() in ai_trading_interfaces.js.

2.13 (October 26th, 2014) Added export legality display mode, and retired the plug-in called AI Trading Legality Reminder.
Flying around in the space, I've caught an interstellar flu... When I get well, I'll try the update to see if anything is changed. ;)
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: AI Trading Assistant version 2.13.1

Post by Diziet Sma »

Wildeblood wrote:
Clutching at straws, trying to resolve Marte's bug I can't reproduce.
<wonders if having a copy of Marte's gamesave file might help>
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
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 »

I had suspected it's some kind of code page issue, sort of like the way if I ever open and re-save one of spara's scripts without changing anything they stop working because a junk character gets added in the change from ISO-8859-15 to ISO-8859-1. But according to wikipedia Marte's computer should be using ISO-8859-1, so I'm mystified.

On a lighter note... Made a Yoda plug-in last night, I did. Curious to see how many days before anyone downloaded it, I was. Surprised this morning, I am. :D
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: AI Trading Assistant

Post by Diziet Sma »

Wildeblood wrote:
On a lighter note... Made a Yoda plug-in last night, I did. Curious to see how many days before anyone downloaded it, I was. Surprised this morning, I am. :D
Noticed that, I did. Curious to check it out, I am.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
spud42
---- E L I T E ----
---- E L I T E ----
Posts: 1568
Joined: Wed Mar 26, 2014 10:11 am
Location: Brisbane,Australia

Re: AI Trading Assistant

Post by spud42 »

if you make a ja ja binks plugin ,im out of here... lol
Arthur: OK. Leave this to me. I'm British. I know how to queue.
OR i could go with
Arthur Dent: I always said there was something fundamentally wrong with the universe.
or simply
42
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 »

spud42 wrote:
if you make a ja ja binks plugin, im out of here... lol
This is a strange OXP which has grown so much over the years, and has hardly any resemblance to the way it started. So I'd say nothing is out of the question. :twisted:
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 »

Version 2.15 is not available through the download manager, because it is untested by me. I'm not playing Oolite any more, and even when I did play, I never did cargo contracts, only passenger contracts. Willing testers would be appreciated.

In theory, with this version you can use automatic selling as well as automatic buying even when you have bulk cargo contracts under way without fear it will sell the goods you need to fulfil contracts. Each time Autotrade starts it scans your contracts list and notes cargo that needs to be reserved.

http://wiki.alioth.net/img_auth.php/0/0 ... t_2.15.oxz
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 »

Thank you to all the people who have sent me messages asking why the version number appears to have jumped from 2.13.x to 2.15. Yes, there was a 2.14, which added a logging interface to Autotrade. Here's a quick plug-in which demonstrates how to use it:-

http://wiki.alioth.net/img_auth.php/4/4 ... Screen.oxz

After Autotrade runs it will add an interface screen listing the transactions it made on your behalf at that station. The log is not cumulative, and is reset for each station. Requires AI Trading Assistant version 2.14 or later.
User avatar
Marte
Competent
Competent
Posts: 32
Joined: Mon Jan 05, 2015 11:06 am

Re: AI Trading Assistant

Post by Marte »

Wildeblood wrote:
I had suspected it's some kind of code page issue, sort of like the way if I ever open and re-save one of spara's scripts without changing anything they stop working because a junk character gets added in the change from ISO-8859-15 to ISO-8859-1. But according to wikipedia Marte's computer should be using ISO-8859-1, so I'm mystified.

On a lighter note... Made a Yoda plug-in last night, I did. Curious to see how many days before anyone downloaded it, I was. Surprised this morning, I am. :D
I've the feeling that the clue is correct...

In fact, I've made a lot of tests.

Now, under my italian Mac, "TA" is still without configuration screen but under PC (Windows 8.1 64, Italian), it works...

But again, under "Windows", the italian keyboard is all messed up (the game works as the keyboard is english and you need to use it in positional way...). Under Mac, italian keyboard is correct (every game function on the correct key...) AND "TA" is problematic...

I see a crossed scheme, here.
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 »

Thanks, Marte.

For ffutures, try this:

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);
        }
    }
richard.a.p.smith
Deadly
Deadly
Posts: 174
Joined: Mon Jun 07, 2010 9:03 am

Re: AI Trading Assistant

Post by richard.a.p.smith »

Hello. Nice work, and useful, but I have found a couple of difficulties. It seems to cause MFDs in numeric HUD to disappear after launching. I also found its screens in f8 a little difficult to follow, seemed to change in an odd manner when I was pressing buttons to trade, eg, average prices, when they appeared or I had made them appear by pressing 8 a few times, went away when I traded something. Not intended to be destructive criticism, just trying to offer up observations, Very pleasing, the Yoda add-on, I found. Ta! Rich.
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:
Hello. Nice work, and useful, but I have found a couple of difficulties.
Hi, Richard. Long time, no see.
richard.a.p.smith wrote:
I also found its screens in f8 a little difficult to follow, seemed to change in an odd manner when I was pressing buttons to trade, eg, average prices, when they appeared or I had made them appear by pressing 8 a few times, went away when I traded something.
Let's see if I can remember how they work, since I've never documented it anywhere, not even inside the javascripts... So...
- Behaviour is different at main stations ("official market") and other markets. At main stations, it starts with either average prices or legality reminder. At other stations, it starts with either average prices or arbitrage screen.
- Behaviour is different doing milk runs or hoarding cargo. After a few seconds it changes to the opportunity cost (number of docks you've hauled cargo to without selling it) screen for 3 seconds, then back again. It will skip that step if you're selling everything every time, and not hoarding anything.
- Behaviour is different using the trainable AI ("observational learning mode") and preset price expectations. When autotrade starts (if you've enabled it), it changes to the buy/sell recommendations list. But that list is based on the preset prices (ruthless or ethical mode), and doesn't appear in observational learning mode.
- While autotrade is running (or if it's off completely) the display won't change again on its own, and you can then cycle through them using the 8 key if you want to.
- But, it should not change the display when you actually perform a trade. If it's doing that(?), that'll be a bug I've introduced somewhere along the way.
Post Reply