[WIP][Mod]TaterTrader v4- An Autotrade Alternative

The place to discuss scripting and game modifications for X4: Foundations.

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

Post Reply
ludsoe
Posts: 21
Joined: Fri, 13. Nov 09, 03:12
x4

[WIP][Mod]TaterTrader v4- An Autotrade Alternative

Post by ludsoe » Mon, 17. Dec 18, 14:54

TaterTrader is a WIP auto-trader script that attempts to generate profit while not using any cheatyness.

Purpose:
TaterTrader is my attempt to provide a semi decent trading script. It attempts to seek out the best deal within the constraints you set when setting up the order.
Ive made a attempt to keep TaterTrader balanced, as it will only do trade deals that the player knows about.
Order CheatSheet
Show
Image
Old Download links
NexusMods Link: https://www.nexusmods.com/x4foundations/mods/151/
OriginalGitHub Link: https://github.com/ludsoe/TaterTrader

DeadAirRT has been maintaining TaterTrader on their own fork. I recommend using their version.
DeadAirRT's GitHub Link: https://github.com/DeadAirRT/TaterTrader
Suggested Mods
Show
Just gonna put some mods I suggest using in general, or alongside TaterTrader.

Station Manager Auto Cash Transfer by Matterom
Mining/Trading Fleet by pesoda
Player Owned Warehouses by TheDeliveryMan

If you guys know of any other mods that pair with TaterTrader nicely, link em so i can put em here.
Features:
  • Attempts to find the best profit based on the configurations of the order given.
  • A bunch of settings you change to tweak how and where it trades.
  • Only trades with trade offers known to the player.
  • Uses the games own built in trade orders to conduct its trades.
  • When the Traders home is set to a station, the station becomes the traders commander.
  • Traders use their commanders money if they have one.
  • The Traders follow faction trade restrictions, unless told otherwise.
  • There's ware list presets you can copy within the configuration options.
  • Fancy outputting to the player log.
  • Station Trader Mode allows you to focus the trader onto a station, to handle all its trade offers. Can be used on both player and NPC owned stations, even accounts for the stations build storage.

Configuration Options:
  • You can define a home sector or station.
  • Can set the trader to always return "Home" before attempting to seek another trade.
  • You can configure which wares the trader attempts to find trade deals for.
  • The maximum distance from home the trader can buy or sell at.
  • Change the Price the Traders perceive wares are set at your own stations. (Doesn't actually affect the cost)
  • You can set the Traders to bypass faction trade restrictions.
  • You can exclude sectors from the trade offer search.
  • You can use preset ware lists, I copied the ones used by the game itself. But I can add based on suggestions.
  • You can set the Trader to compare distances between stations when searching for deals.
  • Enabling Station Trader Mode allows you to focus a stations offers, allowing you to automate your own stations or even NPC owned ones.
  • You can Ban whole factions from being traded with, No more trading with those darn pirates and getting your traders destroyed.
Configuration Option Explaination
Show
  • TraderHome: The sector or station the trader considers its home.
  • HomeBound: Sets if the trader returns back to the home defined by TraderHome after each trade.
  • Buy/Sell Gate Distance modifiers: Sets how far the trader can sell or buy from its home.
  • Owned Station Buy Mod: The percentage of the average price the trader views player owned stations when buying from them.
  • Owned Station Sell Mod: The percentage of the average price the trader views player owned stations when selling to them.
  • FreeTrade: Sets if the trader is allowed to bypass faction trade restrictions set at player owned stations.
  • FastTrade: When enabled, the trader trims down the amount of offers it compares to the absolute minimum.
  • StationTrader: Enables Station Trader mode, The Trader attempts to fulfill any trade offers its Home station has.
  • StationSmuggler: Enables trading illegal goods for Station Trader mode.
  • WareList: The wares the trader is set to search deals for.
  • Use Presets: Tells the trader to copy the wares from selected presets into its warebasket, you can enable multiple at will.
  • (Bunch of presets, enable to flag their wares to be added to the warebasket)
  • Exclude Sector: Disables searching for deals in selected sectors, Doesn't actually prevent path-finding though I cant do that without rewriting the games pathfinder.
  • Include Sector: Always Scans included sectors for trade offers, even if they are not in range.
  • TradeBans: When Enabled and factions selected, prevents the trader from trading with those factions.
  • ScanSpeed: Trade Deals calculating too slow? You can up the scan speed, or down if you favor performance.
Known Bugs:
  • The Trader Becomes highly unstable when homebound is toggled and the home is set to a sector. Either don't use homebound set to a sector, or set the home to station you own. (I'm attempting to fix this but Its taking longer then expected.)
  • The Traders can sometimes become broken when attempting to trade with a Black-market dealer. (This is a problem with the base game.)

This is my first attempt at making a mod for an X game, so there's probably some quirks to be worked out and optimization issues.
Last edited by ludsoe on Tue, 28. Apr 20, 04:24, edited 8 times in total.

Guest242
Posts: 86
Joined: Sun, 12. Feb 17, 19:11
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Guest242 » Mon, 17. Dec 18, 15:09

Super! I will test your mod :)
Will there be any save game issues if I uninstall the mod?

ludsoe
Posts: 21
Joined: Fri, 13. Nov 09, 03:12
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by ludsoe » Mon, 17. Dec 18, 15:35

I don't see why there could be a issue with uninstalling it, It just adds a new default order to the game. I haven't tested removing it though.

Guest242
Posts: 86
Joined: Sun, 12. Feb 17, 19:11
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Guest242 » Mon, 17. Dec 18, 16:10

ludsoe wrote:
Mon, 17. Dec 18, 15:35
I don't see why there could be a issue with uninstalling it, It just adds a new default order to the game. I haven't tested removing it though.
You are right. I tested it and there aren't any problems with loading the save game (even if I didn't cancel the TaterTrade commands on my ships before). Very good.

At the moment I try to supply a shipyard with engine parts. All my trade ships buy engine parts everywhere and will only sell it at the sector of this shipyard. I will see if they could supply it after several hours.
Spoiler
Show
Image

Image


It seems to work for now :)

Image

Varien101
Posts: 63
Joined: Fri, 7. Dec 18, 02:08

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Varien101 » Mon, 17. Dec 18, 16:42

Does this effect NPC trader's as well?

Biggest problem with the game is 60% of the traders in game are transporting those 2 energy cells which kills the economy as real needs go unanswered.

Guest242
Posts: 86
Joined: Sun, 12. Feb 17, 19:11
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Guest242 » Mon, 17. Dec 18, 16:49

Varien101 wrote:
Mon, 17. Dec 18, 16:42
Biggest problem with the game is 60% of the traders in game are transporting those 2 energy cells which kills the economy as real needs go unanswered.
So maybe a option/slider for "Trade only if cargo volume is at least X %". And if not than check next deal.

idragon
Posts: 39
Joined: Fri, 17. Mar 17, 15:37
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by idragon » Mon, 17. Dec 18, 18:54

very good so far, to bad we dont have a proper framework for income generated, beside those basic logs...

havent tested with multiple items, since it takes time, but your trader is much better than the garbage vanilla one, since it takes in consideration the highest selling price in his range. So Thank you again!

THANKS and GOOD JOB!

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by morbideth » Mon, 17. Dec 18, 19:56

Guest242 wrote:
Mon, 17. Dec 18, 16:49
Varien101 wrote:
Mon, 17. Dec 18, 16:42
Biggest problem with the game is 60% of the traders in game are transporting those 2 energy cells which kills the economy as real needs go unanswered.
So maybe a option/slider for "Trade only if cargo volume is at least X %". And if not than check next deal.
I've added:

Code: Select all

<totalvolume min="this.ship.cargo.capacity.all * [(0.9 *(this.ship.pilot.skill.piloting/15)), 0.1].max"/>
to <find_sell_offer> in my personal edit of the trade script. It will only look for sell offers that fill a minimum of 10-90% of the cargo hold depending on the skill level of the pilot.

idragon
Posts: 39
Joined: Fri, 17. Mar 17, 15:37
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by idragon » Mon, 17. Dec 18, 20:13

morbideth wrote:
Mon, 17. Dec 18, 19:56
Guest242 wrote:
Mon, 17. Dec 18, 16:49
Varien101 wrote:
Mon, 17. Dec 18, 16:42
Biggest problem with the game is 60% of the traders in game are transporting those 2 energy cells which kills the economy as real needs go unanswered.
So maybe a option/slider for "Trade only if cargo volume is at least X %". And if not than check next deal.
I've added:

Code: Select all

<totalvolume min="this.ship.cargo.capacity.all * [(0.9 *(this.ship.pilot.skill.piloting/15)), 0.1].max"/>
to <find_sell_offer> in my personal edit of the trade script. It will only look for sell offers that fill a minimum of 10-90% of the cargo hold depending on the skill level of the pilot.
i guess we add this outside match_selled tag, after or before in the <find_sell_offer> ... </find_sell_offer> ?

like this ?

Code: Select all

 
 <find_sell_offer tradepartner="this.ship" space="$buyspaces.{$sector}" result="$sellers" multiple="true" wares="$warebasket.{$ware}">
         <match_seller>
              <match_relation_to object="this.ship" relation="enemy" comparison="not"/>
              <match_seller tradesknownto="this.owner"/>
			  
          </match_seller>
          <totalvolume min="this.ship.cargo.capacity.all * [(0.9 *(this.ship.pilot.skill.piloting/15)), 0.1].max"/>
   </find_sell_offer>
Seems like it needs more than that, can you share with us:P
Last edited by idragon on Mon, 17. Dec 18, 20:18, edited 1 time in total.

Varien101
Posts: 63
Joined: Fri, 7. Dec 18, 02:08

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Varien101 » Mon, 17. Dec 18, 20:16

@morbideth

How would I add just that line of script into an extension?

jmattspartacus2
Posts: 73
Joined: Wed, 5. Dec 18, 07:04

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by jmattspartacus2 » Mon, 17. Dec 18, 20:24

Question, for the perceived cost at player stations, is this for buying or selling, or both?
If both, could we have a slider for both perceived buy price and perceived sell cost? (at your leisure of course, I don't want to be a requesto bot)
I appreciate the effort to maintain the balance :D I'll be keeping an eye on this.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by morbideth » Mon, 17. Dec 18, 21:19

idragon wrote:
Mon, 17. Dec 18, 20:13

i guess we add this outside match_selled tag, after or before in the <find_sell_offer> ... </find_sell_offer> ?

Seems like it needs more than that, can you share with us:P
That's right, just paste the line right into the existing find.
Varien101 wrote:
Mon, 17. Dec 18, 20:16
@morbideth

How would I add just that line of script into an extension?
You would need to create a diff patch for order.trade.middleman, however I'm not sure how it would work with L size traders, they may not be able to find any offers.

Varien101
Posts: 63
Joined: Fri, 7. Dec 18, 02:08

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Varien101 » Mon, 17. Dec 18, 21:29

I have a booming economy in my games so that shouldn't be an issue lol.

using 15 mods and it seems I've found the right ones to keep everything going. Now I just need the traders to stop moving 2 energy cells.



Do the changes effect NPC trade ships as well?



Edit: Downloaded and don't know what you did, don't know how you did it, but the Dev's should be ashamed. Lets just say I had a very personal release of emotions on a sexual level when I setup my first Tatertrader, over... and over... and over... again as I went down my list of large freighters.... It was then that I nearly lost consciousness as pleasure wracked my shaking body while I canceled the auto trade orders and switched them to Tatertrader. Full magnum loads moving through space.

Edit 2: A second Tatertrader (full) would be super useful, same thing as before but puts all wares on the list automatically. Your version of galaxy trade.

Edit 3: Now if we could give orders to multiple trade ships at once.. It would be a gift from the gods

Sleziak
Posts: 5
Joined: Sun, 29. Jul 18, 08:35
xr

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Sleziak » Tue, 18. Dec 18, 01:25

Image

Well isn't that a beautiful sight. Actual cargo holds full of wares. Thank you for this, it's been a godsend so far.

The only issue I've run into is on a couple of occasions my trader has started his buy order at an undiscovered station. Not sure if it could be conflicting with another mod like sector satellites though. Regardless, awesome job so far!

reqw
Posts: 101
Joined: Sat, 13. Jan 07, 15:23
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by reqw » Tue, 18. Dec 18, 03:43

Awsom put it to use and they buy tons and then set up several sell orders at the same time they can even do multi cargo sell orders .

if a select all coud be implemented on weres that whoud be awsom .

Thums Up

Kamuchi_
Posts: 174
Joined: Fri, 7. Dec 18, 05:04
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Kamuchi_ » Tue, 18. Dec 18, 04:32

This is really cool that you got the full cargo sorted, the lack of it is really aggrivating lol

I have 2 suggestion to make this mod the best trader mod.
1. Add a checkbox, like homebound, but have it limit to only buy from player stations.
2. another checkbox to only buy and sell from player stations.

This way you will be providing a normal galaxy trader, player commodity galaxy trader and a galaxy wide distribution trader between player stations all in one without having to use that silly station manager.
I really can't comprehend why Egosoft can't make a decent trader logic, I was half way to ragequit cause no matter what you do, everything relies on those stupid traders :evil:

I did find 1 issue with it, when setting homebound, the traders kept wanting to go to this spot and just started to idle
Spoiler
Show
Image
Fixed it by setting the station as their home so they dock, undock and do the trade.
Don't know if you can tell them 5 seconds after entering their home system (5s to clear the gate a bit) and then remove their fly&wait command?

I thought befor I was supplying the universe, but lol, they just keep going and going with full cargo's :lol:

CaptainLocke
Posts: 4
Joined: Mon, 17. Dec 18, 23:56

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by CaptainLocke » Tue, 18. Dec 18, 05:39

Having a bit of an issue trying to setup a universe trader. I add the wares, set the buy and sell distance, and make sure homebound is not checked. However, after all this he just idles and refuses to trade.

However! If I set his home base to a station and have homebound set, he will import things to his home base no problem, which is fantastic. Am I missing something?

siath70
Posts: 459
Joined: Sun, 11. Jan 04, 03:03
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by siath70 » Tue, 18. Dec 18, 06:17

I said this in the other trader software that's being developed, an option to tell them to not go to a station that is below a certain standing would be nice. I hate that my freighters try to supply SCA and get sacked every time.

Tovrin
Posts: 2
Joined: Tue, 18. Dec 18, 07:13

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Tovrin » Tue, 18. Dec 18, 07:20

The last setting of "Station Owned Cost". Is that 100% discount or 100% cost?

Kamuchi_
Posts: 174
Joined: Fri, 7. Dec 18, 05:04
x4

Re: [WIP][Mod]TaterTrader v1- An Autotrade Alternative

Post by Kamuchi_ » Tue, 18. Dec 18, 07:58

Tovrin wrote:
Tue, 18. Dec 18, 07:20
The last setting of "Station Owned Cost". Is that 100% discount or 100% cost?
As my station is making a ton of money, I'd say that it's 100% buy price :D

Post Reply

Return to “X4: Foundations - Scripts and Modding”