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

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

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

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

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

Post by ludsoe » Mon, 17. Dec 18, 15: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
NexusMods Link: https://www.nexusmods.com/x4foundations/mods/151/
GitHub Link: https://github.com/ludsoe/TaterTrader
Word of warning, The git-hub build may be volatile, as I update it along with my internal testing. Thus Treat it as a version-less Alpha build.
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 Wed, 9. Jan 19, 12:02, edited 7 times in total.

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

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

Post by Guest242 » Mon, 17. Dec 18, 16: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, 04:12
x4

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

Post by ludsoe » Mon, 17. Dec 18, 16: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, 20:11
x4

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

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

ludsoe wrote:
Mon, 17. Dec 18, 16: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, 03:08

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

Post by Varien101 » Mon, 17. Dec 18, 17: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, 20:11
x4

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

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

Varien101 wrote:
Mon, 17. Dec 18, 17: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: 16
Joined: Fri, 17. Mar 17, 16:37

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

Post by idragon » Mon, 17. Dec 18, 19: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: 389
Joined: Sun, 9. Nov 08, 04:07
x3tc

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

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

Guest242 wrote:
Mon, 17. Dec 18, 17:49
Varien101 wrote:
Mon, 17. Dec 18, 17: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: 16
Joined: Fri, 17. Mar 17, 16:37

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

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

morbideth wrote:
Mon, 17. Dec 18, 20:56
Guest242 wrote:
Mon, 17. Dec 18, 17:49
Varien101 wrote:
Mon, 17. Dec 18, 17: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, 21:18, edited 1 time in total.

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

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

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

@morbideth

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

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

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

Post by jmattspartacus2 » Mon, 17. Dec 18, 21: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: 389
Joined: Sun, 9. Nov 08, 04:07
x3tc

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

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

idragon wrote:
Mon, 17. Dec 18, 21: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, 21: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, 03:08

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

Post by Varien101 » Mon, 17. Dec 18, 22: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, 02: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: 100
Joined: Sat, 13. Jan 07, 16:23
x4

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

Post by reqw » Tue, 18. Dec 18, 04: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

Post Reply

Return to “X4: Foundations - Scripts and Modding”