[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

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Fri, 22. May 20, 07:14

Spent about 8 hours working on blacklist stuff.

Annoyed at your precious TaterTraders entering sectors you've banned to reach that precious trade they can't safely reach? Testing my solution that should prevent that from ever happening again.

Cedric_FP
Posts: 189
Joined: Thu, 13. Apr 06, 17:56
x4

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

Post by Cedric_FP » Fri, 22. May 20, 09:17

DeadAirRT wrote:
Fri, 22. May 20, 07:14
Spent about 8 hours working on blacklist stuff.

Annoyed at your precious TaterTraders entering sectors you've banned to reach that precious trade they can't safely reach? Testing my solution that should prevent that from ever happening again.
Legend.

User avatar
bbn
Posts: 88
Joined: Mon, 31. Jan 11, 18:30
x4

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

Post by bbn » Sun, 24. May 20, 00:51

While checking other things I found that TaterTrader is spamming my logs with 2 kind of messages. It's 3.20 beta, so I am not sure if something change or not... or even if those errors are "real errors".

First one:

Code: Select all

[=ERROR=] 24549.48 Error in AI script tatertrade on entity 0x705ed1b: Property lookup failed: $foundselloffer.restriction.faction
* $foundselloffer == trade.{0x43bc4L} (ware=smartchips, buyer=[0x0], seller=[0x10e9c47], bundle=false, unbundle=false, available=true)
* Expression: not ($foundselloffer.restriction.faction == $stationbuyoffer.buyer.owner) and not ($stationbuyoffer.restriction.faction == $foundselloffer.seller.owner) and not ($stationbuyoffer.restriction.faction == $foundselloffer.restriction.faction)
* Action: <do_if>, line 916
Second one:

Code: Select all

[=ERROR=] 24549.18 Error in AI script tatertrade on entity 0x705ed1b: Warning: Loss of data while converting floating point number to a money value! 64.5062f + 15ct
* Expression: $offerpriority + $costdiff / 2

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Sun, 24. May 20, 04:13

bbn wrote:
Sun, 24. May 20, 00:51
While checking other things I found that TaterTrader is spamming my logs with 2 kind of messages. It's 3.20 beta, so I am not sure if something change or not... or even if those errors are "real errors".

First one:

Code: Select all

[=ERROR=] 24549.48 Error in AI script tatertrade on entity 0x705ed1b: Property lookup failed: $foundselloffer.restriction.faction
* $foundselloffer == trade.{0x43bc4L} (ware=smartchips, buyer=[0x0], seller=[0x10e9c47], bundle=false, unbundle=false, available=true)
* Expression: not ($foundselloffer.restriction.faction == $stationbuyoffer.buyer.owner) and not ($stationbuyoffer.restriction.faction == $foundselloffer.seller.owner) and not ($stationbuyoffer.restriction.faction == $foundselloffer.restriction.faction)
* Action: <do_if>, line 916
Second one:

Code: Select all

[=ERROR=] 24549.18 Error in AI script tatertrade on entity 0x705ed1b: Warning: Loss of data while converting floating point number to a money value! 64.5062f + 15ct
* Expression: $offerpriority + $costdiff / 2
I'm not supporting the beta because it would break 3.1 but thanks for the report.

I'll take a look into the second one, it's harmless usually. What settings are you using on trader?

User avatar
bbn
Posts: 88
Joined: Mon, 31. Jan 11, 18:30
x4

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

Post by bbn » Sun, 24. May 20, 11:04

DeadAirRT wrote:
Sun, 24. May 20, 04:13
I'm not supporting the beta because it would break 3.1 but thanks for the report.
Sure, it's seems like it's related to the new trade rules somehow...

I'm guessing that I cannot count on TaterTraders to obey restriction in this save ^^.
DeadAirRT wrote:
Sun, 24. May 20, 04:13
I'll take a look into the second one, it's harmless usually. What settings are you using on trader?
Fortunately, this was quite early in new save, so I have just 4 TaterTraders setup. Don't know exactly which one, but they are set up similar way. I set trader home for 2 of them to ARG Wharf and for the other 2 to ARG Shipyard. Max gate distance to buy set to 10, checked station trader and added all wares to the list.

(now I'm wondering if I should continue 3.2b with mods, go back to my vanilla save, or maybe go back to 3.1...)

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Sun, 24. May 20, 14:59

bbn wrote:
Sun, 24. May 20, 11:04
DeadAirRT wrote:
Sun, 24. May 20, 04:13
I'm not supporting the beta because it would break 3.1 but thanks for the report.
Sure, it's seems like it's related to the new trade rules somehow...

I'm guessing that I cannot count on TaterTraders to obey restriction in this save ^^.
DeadAirRT wrote:
Sun, 24. May 20, 04:13
I'll take a look into the second one, it's harmless usually. What settings are you using on trader?
Fortunately, this was quite early in new save, so I have just 4 TaterTraders setup. Don't know exactly which one, but they are set up similar way. I set trader home for 2 of them to ARG Wharf and for the other 2 to ARG Shipyard. Max gate distance to buy set to 10, checked station trader and added all wares to the list.

(now I'm wondering if I should continue 3.2b with mods, go back to my vanilla save, or maybe go back to 3.1...)
The only problem the 3.2 will cause are traders ignoring "restrict trade to other factions" and the trade rules afaik

User avatar
bbn
Posts: 88
Joined: Mon, 31. Jan 11, 18:30
x4

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

Post by bbn » Mon, 25. May 20, 16:33

DeadAirRT wrote:
Sun, 24. May 20, 14:59
bbn wrote:
Sun, 24. May 20, 11:04
DeadAirRT wrote:
Sun, 24. May 20, 04:13
I'm not supporting the beta because it would break 3.1 but thanks for the report.
Sure, it's seems like it's related to the new trade rules somehow...

I'm guessing that I cannot count on TaterTraders to obey restriction in this save ^^.
DeadAirRT wrote:
Sun, 24. May 20, 04:13
I'll take a look into the second one, it's harmless usually. What settings are you using on trader?
Fortunately, this was quite early in new save, so I have just 4 TaterTraders setup. Don't know exactly which one, but they are set up similar way. I set trader home for 2 of them to ARG Wharf and for the other 2 to ARG Shipyard. Max gate distance to buy set to 10, checked station trader and added all wares to the list.

(now I'm wondering if I should continue 3.2b with mods, go back to my vanilla save, or maybe go back to 3.1...)
The only problem the 3.2 will cause are traders ignoring "restrict trade to other factions" and the trade rules afaik
Just to double confirm for anyone on beta -> that's their behavior. Work perfectly fine for last couple of hours of gameplay, but ignore my travel restrictions.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Mon, 25. May 20, 18:34

So i spent a few hours working on the code yesterday and found a few bugs/unintended behavior.

When using check distance, it will no longer view jumps past a certain number as negative but will instead scale properly with the percent.

When using check distance, it will no longer prefer dangerous trades over safer ones (trades that have no safe route to the destination)

There are some new delays that are skill based to prevent traders from grabbing the same trade at the same moment (the delay is not human noticable). This issue was especially prevalent with civ fleets.

If everything goes right in testing after i get off work, I'll upload version to all platforms today.

New version on GitHub for testing.

Cedric_FP
Posts: 189
Joined: Thu, 13. Apr 06, 17:56
x4

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

Post by Cedric_FP » Thu, 18. Jun 20, 03:37

Is there any way I can restrict my tatertraders to only trade with a certain faction?

I have tried a blacklist, selecting the faction checklist boxes, and also trying to only limit to "included sectors" but they seem to ignore it. I suspect it is me that is doing something wrong, so any guidance on this would be appreciated!

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Thu, 18. Jun 20, 08:51

Cedric_FP wrote:
Thu, 18. Jun 20, 03:37
Is there any way I can restrict my tatertraders to only trade with a certain faction?

I have tried a blacklist, selecting the faction checklist boxes, and also trying to only limit to "included sectors" but they seem to ignore it. I suspect it is me that is doing something wrong, so any guidance on this would be appreciated!
Which version are you running? They shouldn't be ignoring blacklist, trade rules, or faction restriction checklist so something definitely sounds off.

Cedric_FP
Posts: 189
Joined: Thu, 13. Apr 06, 17:56
x4

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

Post by Cedric_FP » Fri, 19. Jun 20, 04:26

DeadAirRT wrote:
Thu, 18. Jun 20, 08:51
Cedric_FP wrote:
Thu, 18. Jun 20, 03:37
Is there any way I can restrict my tatertraders to only trade with a certain faction?

I have tried a blacklist, selecting the faction checklist boxes, and also trying to only limit to "included sectors" but they seem to ignore it. I suspect it is me that is doing something wrong, so any guidance on this would be appreciated!
Which version are you running? They shouldn't be ignoring blacklist, trade rules, or faction restriction checklist so something definitely sounds off.
Yeah it was me doing something wrong. I had gotten my blacklist the wrong way around (i restricted from argon/antigone instead of from everybody else BUT argone and antigone, man I'm dumb). Thanks for taking the time to respond.

On the tatertrader setup for default behavior, in order for me to restrict trade without using a global blacklist, I would tick the "enable trade bans" box and then tick every box I *don't* want my trader to trade with, right?

Do I need to tick 'enable trade bans' if I want to do the included sector method of restricting?

Thanks for your time, Deadair!

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Fri, 19. Jun 20, 04:31

Cedric_FP wrote:
Fri, 19. Jun 20, 04:26
DeadAirRT wrote:
Thu, 18. Jun 20, 08:51
Cedric_FP wrote:
Thu, 18. Jun 20, 03:37
Is there any way I can restrict my tatertraders to only trade with a certain faction?

I have tried a blacklist, selecting the faction checklist boxes, and also trying to only limit to "included sectors" but they seem to ignore it. I suspect it is me that is doing something wrong, so any guidance on this would be appreciated!
Which version are you running? They shouldn't be ignoring blacklist, trade rules, or faction restriction checklist so something definitely sounds off.
Yeah it was me doing something wrong. I had gotten my blacklist the wrong way around (i restricted from argon/antigone instead of from everybody else BUT argone and antigone, man I'm dumb). Thanks for taking the time to respond.

On the tatertrader setup for default behavior, in order for me to restrict trade without using a global blacklist, I would tick the "enable trade bans" box and then tick every box I *don't* want my trader to trade with, right?

Do I need to tick 'enable trade bans' if I want to do the included sector method of restricting?

Thanks for your time, Deadair!
Enable trade bans activates the blocking of trade with the factions checked on the order screen

You can use included or excluded sector by just adding them

As long as you don't check "free trade" they will abide by trade bans and blacklistings

edit - no problem, glad to help

Scoob
Posts: 9921
Joined: Thu, 27. Feb 03, 22:28
x4

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

Post by Scoob » Mon, 22. Jun 20, 03:35

Hi,

I used Tater Trader with an ARG Drill Vanguard to have it sell my excess Nividium from my HQ. This worked great for a while, but after a couple of successful trades this ship CLEARED its TaterTrader task and was re-assigned as a normal Mining ship.

Basically, this TaterTrader was assigned to the Alpha Defence group at the HQ, buying Nividium from the station and selling it to various Trading Stations within five jumps. Now it's assigned its self to Delta Group and is going to mine.

Is this some thing you can investigate? I run multiple mods, so I don't know if a save would be of any use.

Scoob.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Mon, 22. Jun 20, 14:47

Scoob wrote:
Mon, 22. Jun 20, 03:35
Hi,

I used Tater Trader with an ARG Drill Vanguard to have it sell my excess Nividium from my HQ. This worked great for a while, but after a couple of successful trades this ship CLEARED its TaterTrader task and was re-assigned as a normal Mining ship.

Basically, this TaterTrader was assigned to the Alpha Defence group at the HQ, buying Nividium from the station and selling it to various Trading Stations within five jumps. Now it's assigned its self to Delta Group and is going to mine.

Is this some thing you can investigate? I run multiple mods, so I don't know if a save would be of any use.

Scoob.
If you don't assign it to the station it should be fine.

Scoob
Posts: 9921
Joined: Thu, 27. Feb 03, 22:28
x4

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

Post by Scoob » Mon, 22. Jun 20, 15:37

DeadAirRT wrote:
Mon, 22. Jun 20, 14:47
If you don't assign it to the station it should be fine.
Thanks for replying, I appreciate it.

Do you mean don't assign it as a station trader? I just ordered the ship from the Wharf and, once built, set it up as a Tater Trader trading only Nividium. I thought assigning it to the station was essential for this to work correctly? Perhaps I'm missing some nuance of the configuration? I know it worked perfectly for at least two runs, then reset. The second time it didn't even make a single sale, it idled for a bit, then re-assigned its self to the Mining group.

I will play around some more this evening.

If at all possible, could you perhaps screen-shot the exact options I should be using for this role? Basically, selling Nividium from the HQ.

Scoob.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Mon, 22. Jun 20, 16:35

Scoob wrote:
Mon, 22. Jun 20, 15:37
DeadAirRT wrote:
Mon, 22. Jun 20, 14:47
If you don't assign it to the station it should be fine.
Thanks for replying, I appreciate it.

Do you mean don't assign it as a station trader? I just ordered the ship from the Wharf and, once built, set it up as a Tater Trader trading only Nividium. I thought assigning it to the station was essential for this to work correctly? Perhaps I'm missing some nuance of the configuration? I know it worked perfectly for at least two runs, then reset. The second time it didn't even make a single sale, it idled for a bit, then re-assigned its self to the Mining group.

I will play around some more this evening.

If at all possible, could you perhaps screen-shot the exact options I should be using for this role? Basically, selling Nividium from the HQ.

Scoob.
Honestly, i never thought about people using traders for ore. If there are sell orders and buy orders, it should work without assigning to a station.

Scoob
Posts: 9921
Joined: Thu, 27. Feb 03, 22:28
x4

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

Post by Scoob » Mon, 22. Jun 20, 19:33

DeadAirRT wrote:
Mon, 22. Jun 20, 16:35
Honestly, i never thought about people using traders for ore. If there are sell orders and buy orders, it should work without assigning to a station.
Just want to add that this appears to be an issue of the vanilla scripts taking over, rather than TT failing. When I use Mules to do the selling, they work for a while - just like TT - then suddenly that ship is re-assigned to a different group and to regular mining duties.

I will test NOT assigning it to a station and see how that goes. However, does that mean the credits won't go the HQ account? If so, that sorta defeats the point as this station is raising funds to buy other stuff.

Edit: Not assigning the TT to the station sees it sit "searching for trades" endlessly, while there are several valid trades available. I will continue testing.

Edit 2: I can confirm that NOT assigning the ship to a station means it will never make any trades. Whereas assigning it will see it usually make some trades, before reverting to Mining. Something vanilla is overriding the default behaviour.

Scoob.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

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

Post by DeadAirRT » Mon, 22. Jun 20, 20:48

Scoob wrote:
Mon, 22. Jun 20, 19:33
DeadAirRT wrote:
Mon, 22. Jun 20, 16:35
Honestly, i never thought about people using traders for ore. If there are sell orders and buy orders, it should work without assigning to a station.
Just want to add that this appears to be an issue of the vanilla scripts taking over, rather than TT failing. When I use Mules to do the selling, they work for a while - just like TT - then suddenly that ship is re-assigned to a different group and to regular mining duties.

I will test NOT assigning it to a station and see how that goes. However, does that mean the credits won't go the HQ account? If so, that sorta defeats the point as this station is raising funds to buy other stuff.

Edit: Not assigning the TT to the station sees it sit "searching for trades" endlessly, while there are several valid trades available. I will continue testing.

Edit 2: I can confirm that NOT assigning the ship to a station means it will never make any trades. Whereas assigning it will see it usually make some trades, before reverting to Mining. Something vanilla is overriding the default behaviour.

Scoob.
It would probably take a diff to lib.request.orders to prevent vanilla from overriding. I'll see what i can do

Scoob
Posts: 9921
Joined: Thu, 27. Feb 03, 22:28
x4

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

Post by Scoob » Mon, 22. Jun 20, 21:44

DeadAirRT wrote:
Mon, 22. Jun 20, 20:48
It would probably take a diff to lib.request.orders to prevent vanilla from overriding. I'll see what i can do
I noticed there was a slightly newer version of Misunderstood Wookie's branch of the Mules and Warehouses Extended mod. I applied this and now my Mule is trading just fine, without being reassigned - well, it's been running for over an hour without an issue thus far. Perhaps Mules takes into account a recent vanilla change that TT does not? Note: I'm using the "M1 - Travel Mule" option, assigned to my HQ.

It is odd to see the vanilla game behaviour taking over though, so it would be nice if it was fixed. I don't think having a Mining hub like this is a huge leap when it comes to valid game mechanics.

Scoob.

Scoob
Posts: 9921
Joined: Thu, 27. Feb 03, 22:28
x4

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

Post by Scoob » Tue, 23. Jun 20, 00:51

I'm having some weird TT problems this eve, even a normal trader simply isn't working. I'm in a sector with ware selling for well under average and buyers paying way more than average. However, my TT just sits there doing nothing at all. I've tried lots of different combinations of settings impacting range, wares bought / sold, factions dealt with, explicit sectors etc. but nothing works. There are very viable trades in one particular sector, but even limiting just to this sector the TT does nothing. I'm very confused.

Note, my settings for the TT currently:

Trader Home: Heart of Acrimony II
Home Bound: unchecked.

Ranges both zero - plenty of local trades.

All settings Unchecked except "Legal Wares"

That's it, yet it isn't moving. Any ideas?

Edit: it just woke up! Typical lol. I had to use the copy preset to include ALL wares, I've not had to do that with my other TT's, they just traded based off having "Legal Wares" checked. I did update the script a few days ago, did something change?

Scoob.

Post Reply

Return to “X4: Foundations - Scripts and Modding”