[SCR] [X3AP] Shopping Assistant 1.2 [UPDATED: 11/08/2014]

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

[SCR] [X3AP] Shopping Assistant 1.2 [UPDATED: 11/08/2014]

Post by zanzal »

Shopping Assistant

Image

Do you ever get annoyed at needing to fetch a bunch of wares for a storyline mission? As if you don't have better things to do with your time. Now you can grab a combat mission or go exploring while one of your freighters tracks down items on your shopping list. The shopping assistant buys what you tell it to buy in the amounts you tell it to get. You give it a list and it takes care of the details leaving you to focus on more important matters.

Features:

1. Each ship can be given its own customized shopping list and final "Dock at" a station when complete.
2. Intelligent cargo space tracking limits you to a number of wares that can actually fit in the ship with a full load of jump fuel. If you can't tell it to buy 10000 microchips its probably because you can't fit 10000 in your cargo bay.
3. Great when used with TLs carrying freight drones - Automatically performs purchases using drones if needed.
4. Can be used to tell the ship to buy certain equipment.
5. Can be used to tell a TL to go buy stations for you.

Requirements

Trade Command Software Mk2

Instructions

Install the script archive using the plugin manager. Afterwards any ship with Trade Command Software Mk2 can go do your shopping for you by using the Shopping Assistant command under the ship's trade menu.

Options

You can configure the ship to dock at a station you specify after the shopping is complete. It will not unload any wares though. Once its done you'll have to tell it what to do next.

Automatic integration with the Mk3 Blacklist Manager. If you use the Mk3 Blacklist Manager to blacklist a sector/station the shopper won't go there.
Last edited by zanzal on Sun, 9. Nov 14, 05:19, edited 6 times in total.
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

Links

Download Shopping Assistant v1.2
GitHub Page

Compatibility

X3AP Vanilla: Yes
X3AP XRM: Yes
X3AP LU: No
X3AP Other Total Conversions: Yes - Probably
X3TC Any: No


License

This version of the Shopping Assistant is licensed as CC-BY-SA version 4.0 International. You have the right to modify and release modifications without asking me. You don't need to get my permission or notify me in any way. You are obligated to mention Zanzal as the origin of the script and to provide others with these same rights and obligations to your modified version (They would have to mention your name as well as my name in their modified versions and must be freely allowed to modify and distribute your changes). You may only combine this script with a larger work if your larger work also shares a compatible license that meets these obligations and confers these rights. Modified versions must not be released under the exact same name to avoid confusion (You must call your modified version of the script something other than 'Shopping Assistant').

Version History

v1.2 - Released - 11/08/2014

+ Fixed bug where buying more than one of the same ST class item causes the SA to dock and undock repeatedly.
+ Added estimated max cost and wallet balance to the SA screen.
+ Numerous small bug fixes to trading logic.

v1.1 - Released - 11/04/2014

+ Fixed bug with notoriety not being properly considered for some purchases.
+ Fixed bug with TLs trying to equipment upgrades at stations without a capital docking port.
+ New Feature: TLs can now be told to purchase stations!

v1.0 - Initial release - 10/30/2014
Last edited by zanzal on Wed, 3. Dec 14, 03:57, edited 13 times in total.
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe »

Good job !

LU has the Courier feature however, so I wouldn't recommend it. Your "maybe" in the compatibility section is highly optimistic, because LU uses different wares (ammo, nividium, etc.).
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

Yes, I agree LU compatibility should be a No. I was definitely feeling optimistic, but now that you mention it, the command slot I used conflicts with LU.
FishBone_B
Posts: 16
Joined: Tue, 8. Sep 09, 14:18
x4

Post by FishBone_B »

Loving this script, but ran into an issue.

X3 - AP - XRM

Hub Quest: Using a TL with 20 freight drones to buy 15k Scott spices, 10k Dilax Wheat and 10k BoFu. I have plenty of money.

Everything works fine for scott spices, TL jumps around and uses the shopping drones to purchase. Once the Scott Spices are done he jumps to Xenon hub and docks, with the message "Shopping Assistant: failed to purchase all products".

What is the reason he won't buy the Wheat and Bofu? There is plenty in the universe (checked with best buy). I even jumped him to Montalaar which had 10k wheat in a farm, and the TL just jumps back to the hub with the failed message.

What is the reason for the failure?

Thanks!
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

A couple of thoughts:

1. Check the friend / foe settings on the TL, make sure they are correct.
2. Check the TL's homebase setting - If the TL is homebased then it is using the Homebase's funds to make the purchases - so if the homebase runs out of money then it will stop early.
FishBone_B
Posts: 16
Joined: Tue, 8. Sep 09, 14:18
x4

Post by FishBone_B »

It's stuck on the BoFU, won't buy it. I removed the BoFu and it bought the other resources.

The TL is not homebased, and I have plenty of millions/standing so that's definatly not the issue. Friend/Foe settings are also set to "Friend" for all commonwealth races.

I noticed after giving the command for BoFu alone, it briefly said "Buy ware...none"

Perhaps there is a reference error in the script somewhere?
Last edited by FishBone_B on Sat, 1. Nov 14, 21:46, edited 1 time in total.
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

Thank you for reporting the issue. I'll post a release as soon as I've tracked down the source of the BoFu bias.
FishBone_B
Posts: 16
Joined: Tue, 8. Sep 09, 14:18
x4

Post by FishBone_B »

Editted my post with additional info.
Ashnag
Posts: 37
Joined: Wed, 2. May 12, 10:17
x4

Post by Ashnag »

Hi

Tried it yesterday.

Ordered a Tl to buy 3 wares, weapons i think. I did my business while the TL was working, and had to save and quit game.
Launched the game, the save was corrupted. I will make a new try to check if there was something wrong.
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

Hello Ashnag,

To think that any MCSI script could cause save game corruption is beyond imaginable. I've been using the Shopping Assistant since I first wrote it in February and haven't had a single save game corruption using any mod ever. What mods and scripts are you running?
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

FishBone, I sent a TL to buy a bunch of BoFu in my XRM game. I am now the proud owner of 7208 BoFu (the most the TL I used could hold)... I think the next update for the Shopping Assistant I'm going to add a little bit of detail as to why the Shopping Assistant stopped shopping. Normally the reasons are out of cash or it couldn't buy it anyplace safe - sectors it could buy from were infested with enemies either real enemies or enemies as determined from the Friend/Foe settings.

Flashing buy ware...none and then stopping means the script thinks that you might not have enough to complete the transaction. The script does use the most pessimistic formula for determining the amount of money you need - it bases its calculation on the maximum ware cost. So 10k Bofu would normally cost maybe 2-3mil at most, but the script will assume it would cost the maximum of 4mil and it wouldn't even try unless you had that much. Still you say you got tons of cash so 3-4 mil doesn't sound like it should be a problem. It is a little strange.

I'm gonna start planning my next round of changes to the script and unless I discover the actual bug causing the issues the updated one should be ready next week. I'll make it so it tells you how much it thinks the items are going to cost and how much money it thinks you have... That way if there is an issue with the way costs are being calculated it will be more obvious.
FishBone_B
Posts: 16
Joined: Tue, 8. Sep 09, 14:18
x4

Post by FishBone_B »

Well, you're right. Apparently I had 250 million, but was in a sub-account and only had 3 million in my active account, so the script stopped after buying the other wares.

Sorry for the hassle, but would indeed be a good idea to have some kind of feedback ingame as to the reason the assistant stops.

Thanks!
Ashnag
Posts: 37
Joined: Wed, 2. May 12, 10:17
x4

Post by Ashnag »

Hi again

I used it again and everything was ok. Dunno why i had an error with the save, it was the first time.

May i suggest some modifications like allowing to modify the wares without wiping the complete list ? And also remove some wares that cannot be bought.

By the way, it's a very good tool, thanks for it :)
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

@ Ashnag, regarding the removal of wares that can't be bought - yes improvements to this should be available shortly. It will remove the ability to choose wares that the player doesn't know about. It should help a lot by removing many of those phantom wares that just don't exist.

You can also remove individual wares without clearing the shopping list. To do this move the slider for the ware count to zero and press enter. It will be removed from the list.
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

FishBone_B wrote:Well, you're right. Apparently I had 250 million, but was in a sub-account and only had 3 million in my active account, so the script stopped after buying the other wares.!
Yeah that will do it. I am glad you let me know that was the issue. I do the same thing sometimes. I can fix it though and make it more obvious what is going on.
FishBone_B
Posts: 16
Joined: Tue, 8. Sep 09, 14:18
x4

Post by FishBone_B »

zanzal wrote:
FishBone_B wrote:Well, you're right. Apparently I had 250 million, but was in a sub-account and only had 3 million in my active account, so the script stopped after buying the other wares.!
Yeah that will do it. I am glad you let me know that was the issue. I do the same thing sometimes. I can fix it though and make it more obvious what is going on.
Didn't want to be responsible for you troubleshooting a non-existant issue for the next few weeks :wink:

One thing that might be nice is a way to remove/clear the "When finished dock at station" option, as to make the shopper just let you know when he's done, without having to jump & dock at some far away station.
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

Yes, your right, there should be a way to clear the final destination. Right now, I just assign a new final destination of a solar power plant so that I know my shopper has max jump fuel after the job is done.
zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal »

Version 1.1 is ready. TLs can now buy stations. Great when you want to do one of those build station missions. Tell the TL to buy the station and it figures out where to get it. No more messing around with the encyclopedia or searching shipyards. Only lets you choose stations you know about and can purchase with your notoriety at shipyards you've discovered.

Natural wares (Engine Components, Medical Equipment, etc.) can no longer be purchases using this command. If this causes you any issues let me know about it. Also, only known wares can now be purchases. Sorry about that, it was always intended to work that way.

Also found and fixed a couple bugs that caused it to not always be able to purchase equipment upgrades.

Still on the TODO List for the Next Release: A cost estimate and a wallet balance display, better "when finished" commands.
FishBone_B
Posts: 16
Joined: Tue, 8. Sep 09, 14:18
x4

Post by FishBone_B »

Question: How does the shopping assistant decide where to buy resources?

In my game he keeps jumping to Trading docks (still for that BoFu) to buy small amounts of expensive wares, while in nearby sectors there are multiple factories selling thousands for much lower prices.

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”