[OUTDATED] Autotrade Logic Adjustment v1.0.2

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

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

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

[OUTDATED] Autotrade Logic Adjustment v1.0.2

Post by Vim Razz » Wed, 2. Jan 19, 13:05

Autotrade Logic Adjustment
v1.0.2 for X4: Foundations v1.5

This has been my white whale for a few weeks now, but I've finally got it to a point where I'm pretty happy with it. It fixes a number of the issues that have prevented vanilla Autotraders from performing as well as one would hope.

Description:
This is not a major overhaul of the vanilla script by any means. Generally, I've tried to keep changes as minimal as possible. It's intended to be a temporary fix for current problems with autotrader logic until Ego gets around to taking a closer look at them, rather than any kind of permanent "upgrade" to vanilla traders. I did have to get a little creative and make some subjective judgements to make things work in some areas, though, so I do consider it to be more of a mod than a pure "fix".

Download:
It can be found on NexusMods at: https://www.nexusmods.com/x4foundations/mods/243
Or it's available as a dropbox download: Autotrade Logic Adjustment v1.0.2

Installation: The .zip file needs to be unzipped into the extensions folder of the game directory: "..\X4 Foundations\extensions". If the "extensions" folder does not exist, then you'll need to create it.

If you really want all the gory details, you can read them in the header of the trade.find.free file in the mod itself. It seems they're a little too long to fit in a post here.

For the TLDR version:
  • Player owned ships will search all zones for trade offers that the player orders them to. (No, they weren't doing that already.)
  • Player owned ships will evaluate trades based on their potential profit margin, and choose the best that they can find. (No, they weren't quite doing that either.)
  • If the player doesn't have enough money for the full purchase price of a trade, then only the quantity they can afford to buy will be considered in the evaluation.
  • If a freighter has no cargo drones, then it will not attempt to trade with any stations that do not have cargo drones of their own.
  • NPC traders will make their "best trade" determination on the basis of moving as much volume as they can at the highest price differential they can find rather than monetary profit, because they don't use money to build their ships and stations, so I figure they're more concerned with just keeping the materials flowing as best they can.
There are also some other things I investigated that didn't require fixing, but I thought I'd mention them here because people might want to know:
  • I looked into the possibility of freighters trying to trade with stations that don't have pier modules. It doesn't happen, so that's not something to worry about.
  • I'm still looking into traders trying to trade with enemy Build Storage units, as this has been reported again recently. I haven't been able to replicate on my own yet, though, and no additional measures will be taken in this mod until I've found something solid I can test the results against.
  • When it comes to player owned traders visiting stations the player hasn't discovered yet, I only observed this to happen when I had a trade subscription with the faction in question, so I decided to leave it be. If you've spent the millions for a permanent trade subscription from a faction, then I don't think it's a problem that your ship's captains have information about where the stations with those trades are. (Even if you yourself haven't bothered to find them).
Let me know if you have any troubles.
Revision History
Show
[2 Jan 2019] v1.0 for X4 v1.5
  • Initial release
[4 Jan 2019] v1.0.1 for X4 v1.5
  • some appropriately facepalm-worthy bugfixes
[4 Jan 2019] v1.0.2 for X4 v1.5
  • Fixed content.xml and packaged data files in .cat format.
Last edited by Vim Razz on Tue, 17. May 22, 05:45, edited 19 times in total.

User avatar
Holzapfel
Posts: 97
Joined: Fri, 22. Nov 13, 22:16
x3ap

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by Holzapfel » Wed, 2. Jan 19, 13:21

Vim Razz wrote:
Wed, 2. Jan 19, 13:05


For the TLDR version:
  • Player owned ships will search all zones for trade offers that the players orders them to. (No, they weren't doing that already.)
  • Player owned ships will evaluate trades based on their potential profit margin, and choose the best that they can find. (No, they weren't quite doing that either.)
Thats SHOCKING
Gonna install it right away. Thanks for your work.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by Vim Razz » Wed, 2. Jan 19, 13:27

Holzapfel wrote:
Wed, 2. Jan 19, 13:21
Vim Razz wrote:
Wed, 2. Jan 19, 13:05


For the TLDR version:
  • Player owned ships will search all zones for trade offers that the players orders them to. (No, they weren't doing that already.)
  • Player owned ships will evaluate trades based on their potential profit margin, and choose the best that they can find. (No, they weren't quite doing that either.)
Thats SHOCKING
Gonna install it right away. Thanks for your work.
Chears, Things are going well for player owned ships, but I just noticed that a few NPC ship types are having trouble. There will be a fix up up for that shortly.


EDIT: false alarm. I was browsing through some older log files and didn't realize which directory I was in. Things should be working okay, I hope.

Wonsz
Posts: 65
Joined: Mon, 10. Dec 18, 23:51
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by Wonsz » Wed, 2. Jan 19, 14:05

Sounds great, especially for someone who doesn't wish to add anything new to the autotrade function, but only to see it working ;)

Is autotrader assigned to a station affected by this mod in any way?

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by Vim Razz » Wed, 2. Jan 19, 14:28

Wonsz wrote:
Wed, 2. Jan 19, 14:05
Is autotrader assigned to a station affected by this mod in any way?
No, those ships use a different script to locate trades than free traders do. I know that ubuntufreakdragon has made good progress on a fix for that script from a conversation in this thread, but I don't know how close they currently are to finishing it or what their plans might be.

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by KRM398 » Wed, 2. Jan 19, 15:46

Drop this in an add ons folder or not? not very good at this.. :(

User avatar
alt3rn1ty
Posts: 2390
Joined: Thu, 26. Jan 06, 19:45
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by alt3rn1ty » Wed, 2. Jan 19, 16:02

At OP

Did you know about Euclids AutoTrader ?

viewtopic.php?f=181&t=406859
Laptop Dell G15 5510 : Win 11 x64
CPU - 10th Gen' Core I7 10870H 2.2-5.0ghz, GPU - NVidia Geforce RTX 3060, VRAM 6gb GDDR5,
RAM - 32gb (2x16gb, Dual Channel mode set in BIOS) DDR4 2933mhz Kingston Fury Impact,
SSD - Kioxia M.2 NVME 512gb (System), + Samsung M.2 NVME 970 Evo Plus 1tb (Games)

:boron: Long live Queen Polypheides and may her tentacles always be supple.
Seeker of Sohnen.

ApoxNM
Posts: 777
Joined: Wed, 5. Dec 18, 06:17
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by ApoxNM » Wed, 2. Jan 19, 16:35

Is this a auto trade fix, as in not a seperate option, it's just changes the vanilla autotrade? Unlike Tatretrade, which is a seperate trade option?

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by Vim Razz » Wed, 2. Jan 19, 20:33

KRM398 wrote:
Wed, 2. Jan 19, 15:46
Drop this in an add ons folder or not? not very good at this.. :(
Yes, The .zip file needs to be unzipped into the extensions folder of the game directory: "..\X4 Foundations\extensions". If the "extensions" folder does not exist, then you'll need to create it.

I should have had that information in the OP, sorry.

alt3rn1ty wrote:
Wed, 2. Jan 19, 16:02
Did you know about Euclids AutoTrader ?
I am familiar with it. This mod doesn't do quite the same thing.

ApoxNM wrote:
Wed, 2. Jan 19, 16:35
Is this a auto trade fix, as in not a seperate option, it's just changes the vanilla autotrade? Unlike Tatretrade, which is a seperate trade option?

Yes, specifically: this mod replaces the final stage of decision making logic for vanilla autotraders, and makes adjustments to other parts of the search and decision making logic script that have been causing vanilla traders trouble.

It does not add any new features or options, and is not a stand-alone trader. It affects all NPC faction traders as well as player owned ships, though the specific behavior is slightly different for NPC traders: they use different criteria for "good trades" then player owned ships. NPC owned ships wont search as many zones as player owned ships, but they will search a few more than they did previously. (Specifically: they'll search until they find trade offers in up to three zones, as opposed to one.)

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by KRM398 » Wed, 2. Jan 19, 20:54

unzipped it then took the new folder and dropped it into the new add ons folder, tada done, ty for the help. :roll:

ApoxNM
Posts: 777
Joined: Wed, 5. Dec 18, 06:17
x4

Re: [MOD/Fix] Autotrader Logic Adjustment v1.0

Post by ApoxNM » Wed, 2. Jan 19, 21:24

Vim Razz wrote:
Wed, 2. Jan 19, 20:33
ApoxNM wrote:
Wed, 2. Jan 19, 16:35
Is this a auto trade fix, as in not a seperate option, it's just changes the vanilla autotrade? Unlike Tatretrade, which is a seperate trade option?

Yes, specifically: this mod replaces the final stage of decision making logic for vanilla autotraders, and makes adjustments to other parts of the search and decision making logic script that have been causing vanilla traders trouble.

It does not add any new features or options, and is not a stand-alone trader. It affects all NPC faction traders as well as player owned ships, though the specific behavior is slightly different for NPC traders: they use different criteria for "good trades" then player owned ships. NPC owned ships wont search as many zones as player owned ships, but they will search a few more than they did previously. (Specifically: they'll search until they find trade offers in up to three zones, as opposed to one.)
Thanks for the info and the effort, will try, sounds really good!

User avatar
ThalonMook
Posts: 1296
Joined: Tue, 3. Feb 04, 12:11
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by ThalonMook » Fri, 4. Jan 19, 14:00

Hi,

thx for the script I test it atm.

It wont run on my Win 7 system.
I play the GOG version 1.5 with german language.
So I checked the content.xml
If you want to have all users can use it the content.xml should look like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<content id="vrTempFix_AutoTraderLogic" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" version="100" date="2018-02-01" save="false" enabled="true">
 <text language="44" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="7" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="33" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="34" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="39" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="49" name="Autotrader Logic Adjustment" description="Versucht, mehrere Probleme zu lösen, die dazu führen, dass aiscripts/find.trade.free schlechte Ergebnisse liefert." author="Vim Razz" />
 <text language="55" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="81" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="82" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="86" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
 <text language="88" name="Autotrader Logic Adjustment" description="Attempts to address several issues causing aiscripts/find.trade.free to put out poor results." author="Vim Razz" />
</content>
Cu Thalon

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by MegaJohnny » Fri, 4. Jan 19, 14:13

Bless you, Vim Razz! I'm looking forward to playing with this mod this weekend.

And well done on the AI script bug reports I just saw you post in the tech support forum. Hope someone from Ego spots them. :)

User avatar
alt3rn1ty
Posts: 2390
Joined: Thu, 26. Jan 06, 19:45
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by alt3rn1ty » Fri, 4. Jan 19, 16:22

Damn good find and fix, there is also a DevNet forum for reporting vanilla game bugs here ..

viewforum.php?f=192

.. Which does get the Devs attention (be sure to read the sticky posts, its a bit more restricted on the content of post reports, so as to cut down on typical forum rubbish which is irrelevant to Developers)
Laptop Dell G15 5510 : Win 11 x64
CPU - 10th Gen' Core I7 10870H 2.2-5.0ghz, GPU - NVidia Geforce RTX 3060, VRAM 6gb GDDR5,
RAM - 32gb (2x16gb, Dual Channel mode set in BIOS) DDR4 2933mhz Kingston Fury Impact,
SSD - Kioxia M.2 NVME 512gb (System), + Samsung M.2 NVME 970 Evo Plus 1tb (Games)

:boron: Long live Queen Polypheides and may her tentacles always be supple.
Seeker of Sohnen.

User avatar
alt3rn1ty
Posts: 2390
Joined: Thu, 26. Jan 06, 19:45
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by alt3rn1ty » Fri, 4. Jan 19, 16:58

@Vim Razz

In case you are not a member of DevNet .. I made a bug report on your behalf, linking the Tech Support topic and quoting the OP, and your mod here.

viewtopic.php?f=192&t=411886

(although I think that part of the DevNet is public anyway, and does not need you to become a member agreeing to non-disclosure)
Laptop Dell G15 5510 : Win 11 x64
CPU - 10th Gen' Core I7 10870H 2.2-5.0ghz, GPU - NVidia Geforce RTX 3060, VRAM 6gb GDDR5,
RAM - 32gb (2x16gb, Dual Channel mode set in BIOS) DDR4 2933mhz Kingston Fury Impact,
SSD - Kioxia M.2 NVME 512gb (System), + Samsung M.2 NVME 970 Evo Plus 1tb (Games)

:boron: Long live Queen Polypheides and may her tentacles always be supple.
Seeker of Sohnen.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by Vim Razz » Fri, 4. Jan 19, 19:45

ThalonMook wrote:
Fri, 4. Jan 19, 14:00
thx for the script I test it atm.

It wont run on my Win 7 system.
I play the GOG version 1.5 with german language.
So I checked the content.xml
If you want to have all users can use it the content.xml should look like this:
...
Thanks! I'll update that when I get home this evening. Is fixing the content.xml file enough for it to work with Windows 7?

I've read that some Windows 7 users need to put extensions in a folder in the Documents directory, but I don't know how that works.

MegaJohnny wrote:
Fri, 4. Jan 19, 14:13
Bless you, Vim Razz! I'm looking forward to playing with this mod this weekend.

And well done on the AI script bug reports I just saw you post in the tech support forum. Hope someone from Ego spots them. :)
Thanks! When I first started this journey I thought I'd be able to get a full bug report out in time to be considered for the 1.5 beta cycle, but that turned out to be overly optimistic.

alt3rn1ty wrote:
Fri, 4. Jan 19, 16:58
In case you are not a member of DevNet .. I made a bug report on your behalf, linking the Tech Support topic and quoting the OP, and your mod here.

viewtopic.php?f=192&t=411886

(although I think that part of the DevNet is public anyway, and does not need you to become a member agreeing to non-disclosure)
Thanks! I had forgotten about DevNet, but I'll be sure to remember it if I find anything else worthy of reporting.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by Vim Razz » Fri, 4. Jan 19, 19:51

Also, related to the 1.0.1 update: it's a bugfix I finished late last night (addressing two bugs in my mod, and one additional bug found with trade.find.free), though I wasn't going to bump the thread until after I finished my full bug report and Nexus page.

I finished the bug report, but fell asleep before getting it onto Nexus.

I'll be doing that tonight and putting out 1.0.2 with the content.xml fixes suggested by ThalonMook.

Wiesel No1
Posts: 37
Joined: Sat, 28. Feb 04, 00:14

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by Wiesel No1 » Fri, 4. Jan 19, 23:04

Hi,
is it normal, that this mod is not shown in the extensions menu ingame?
best regards
EDIT: I used the posted code stuff for the content.xml.
EDIT2: When I use the org one as posted with my german win8 sys its not working. only one time the game was starting.

EDIT3: is it possible that you broke the max jumpgate restriction? it travels half the galaxy instea max 5 as I ordered and has still not the full cargo equiped (and no I have 90 mil credits on stock for some cheap EC)

User avatar
ThalonMook
Posts: 1296
Joined: Tue, 3. Feb 04, 12:11
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by ThalonMook » Sat, 5. Jan 19, 02:05

Hi,

best practice is to make a cat archive then the mods normaly will work on every system.

I did it and your script is running ;-)

Cu

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Re: [MOD/FIX] Autotrade Logic Adjustment v1.0.1

Post by Vim Razz » Sat, 5. Jan 19, 09:46

Soo... it's up on Nexus now, aside from that, the only difference between v1.0.1 and v1.0.2 are the content.xml, and the data files are now in a .cat package.


Wiesel No1 wrote:
Fri, 4. Jan 19, 23:04
Hi,
is it normal, that this mod is not shown in the extensions menu ingame?
best regards
EDIT: I used the posted code stuff for the content.xml.
EDIT2: When I use the org one as posted with my german win8 sys its not working. only one time the game was starting.

EDIT3: is it possible that you broke the max jumpgate restriction? it travels half the galaxy instea max 5 as I ordered and has still not the full cargo equiped (and no I have 90 mil credits on stock for some cheap EC)
Hopefully fixing content.xml and putting it in a .cat will prevent the problems from happening again.

I'm confident that it doesn't change gate restrictions. 5 gates is actually quite far, especially if you start near a highway. It can get you from Argon Prime to Ianamus Zura IV or Pontifex's claim.

When I was testing to see if the .cat version was working properly, I bought this Demeter Vanguard from the ALI Wharf in Trinity Sanctum VII and set it to 5 gates buy&sell range. The report is a bit confusing to read (it's from is from a separate mod I've been using to log data and test things), but even starting one sector away from the highway, it still searched 27 sectors in total all the way to Holy Vision and Hatikvah's Choice.

ThalonMook wrote:
Sat, 5. Jan 19, 02:05
best practice is to make a cat archive then the mods normaly will work on every system.

I did it and your script is running ;-)
Great. I put things in a cat. Hopefully it works for other people, too. Thanks for your help.

Post Reply

Return to “X4: Foundations - Scripts and Modding”