[MOD] AutoTrader with Options ver. 0.8 Jan. 20, 2023

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

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

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.6 Jan. 11, 2019

Post by euclid » Mon, 18. Feb 19, 15:48

ROMB wrote:
Mon, 21. Jan 19, 22:12
Hi Euclid. After some debugging I finally able to find what is the issue in your script, and why it goes into negative profits.
In Version 0.6, File: AutoTraderOptions\aiscripts\stationautotrade.xml Line: 209 you set buyoffer to new offer each time you analyze new ware. Because of this you loosing actual profitable buyoffer. I fixed this by renaming $byoffer to $byoffertmp on lines 209, 226-229, 232 and adding after line 232

Code: Select all

<set_value name="$buyoffer" exact="$buyoffertmp" />
Hope that helps :)
Nice catch, thanks a lot :-)

I've uploaded a new version with the changes you've suggested. Please see changelog in the OP for details.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

graphicboy
Posts: 718
Joined: Wed, 3. Jul 13, 03:21
xr

Re: [MOD] AutoTrader with Options ver. 0.6 Jan. 11, 2019

Post by graphicboy » Sat, 16. Mar 19, 18:46

euclid wrote:
Mon, 18. Feb 19, 15:48
There's still something awry with negative profit, and I think it's tied to pilot level. I have the "learn all the things" mod, so my pilots actually level up. After a while, and with 30+ traders running, I consistently start losing money. Replicated on more than one "new game".

graphicboy
Posts: 718
Joined: Wed, 3. Jul 13, 03:21
xr

Re: [MOD] AutoTrader with Options ver. 0.6 Jan. 11, 2019

Post by graphicboy » Sat, 16. Mar 19, 23:46

euclid wrote:
Mon, 18. Feb 19, 15:48
Update - left it running since that post, and now I'm well into the positive... not sure what's going on. :? Regardless, thank you for the mod :)

Kalypzo
Posts: 5
Joined: Tue, 9. Apr 19, 09:28

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by Kalypzo » Tue, 9. Apr 19, 09:32

Noticed an issue with the traders fee.
I'll have to look closer but at current over half of my profits are unaccounted for.

E.g

Bought wares for 795,000
Sold wares for 1,950,000
Your profit is 525,000


No fee should be 1.2mil. how much does he take?

And is there a way to lower his commission fee in the coding? What would I be looking for?

Kalypzo
Posts: 5
Joined: Tue, 9. Apr 19, 09:28

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by Kalypzo » Tue, 9. Apr 19, 09:53

Kalypzo wrote:
Tue, 9. Apr 19, 09:32
Noticed an issue with the traders fee.
I'll have to look closer but at current over half of my profits are unaccounted for.

E.g

Bought wares for 795,000
Sold wares for 1,950,000
Your profit is 525,000


No fee should be 1.2mil. profits. how much does he take?

And is there a way to lower his commission fee in the coding? What would I be looking for?

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Tue, 9. Apr 19, 12:19

Kalypzo wrote:
Tue, 9. Apr 19, 09:32
Noticed an issue with the traders fee.
I'll have to look closer but at current over half of my profits are unaccounted for.

E.g

Bought wares for 795,000
Sold wares for 1,950,000
Your profit is 525,000


No fee should be 1.2mil. how much does he take?

And is there a way to lower his commission fee in the coding? What would I be looking for?
Hi Kalypso :-)

The commission charges are calculated as:

Code: Select all

 <set_value name="$Level" exact="[this.assignedcontrolled.combinedskill,90].min" /> 
 <set_value name="$ComCharge" exact="100-$Level/4"/> 
which means at most 22.5% of the profit. In your case the profit displayed is not right. It should be at least about 860k. I'll check the code.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Kalypzo
Posts: 5
Joined: Tue, 9. Apr 19, 09:28

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by Kalypzo » Wed, 10. Apr 19, 03:34

So what value would I change to drop the commission to say 10%

Kalypzo
Posts: 5
Joined: Tue, 9. Apr 19, 09:28

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by Kalypzo » Thu, 11. Apr 19, 04:12

Euclid?

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Thu, 11. Apr 19, 14:55

I've checked the code and can't see anything obvious that could cause that. Will need to do some in-game testing.

Concerning your question: Just put $Level = 0 for no fee.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Kalypzo
Posts: 5
Joined: Tue, 9. Apr 19, 09:28

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by Kalypzo » Thu, 11. Apr 19, 15:25

euclid wrote:
Thu, 11. Apr 19, 14:55
I've checked the code and can't see anything obvious that could cause that. Will need to do some in-game testing.

Concerning your question: Just put $Level = 0 for no fee.

Cheers Euclid
Don't mind the fee, it doesn't break the game
Thanks for the info, and well done

kyrnn
Posts: 7
Joined: Thu, 15. Oct 09, 05:58
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by kyrnn » Fri, 12. Apr 19, 14:42

I wanted to stop AutoMiner, so I can upgrade its ship but every time I try comm to the AutoMiner, there's no Autotrader options in comm menu? What am I missing? My AutoMiner is still carrying on and have an asterisk by name so obviously, the mod is still working but I can't find a way to stop it for a moment.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Fri, 12. Apr 19, 20:50

There should be an option "Stop Auto Trade". It works in my game.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

kyrnn
Posts: 7
Joined: Thu, 15. Oct 09, 05:58
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by kyrnn » Fri, 12. Apr 19, 22:55

That's odd, see my screenshots below and as you can see, there's no option to stop AutoTrader?

https://imagebin.ca/v/4dTuyr2xUldk
https://imagebin.ca/v/4dTvKi4aeX0O

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Sat, 13. Apr 19, 15:45

Do you have any other ship on AutoTrade? If so, please try this:

Select the ship from the property menu and select "Comm". Do you see the "Auto Trade Option" ?

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

kyrnn
Posts: 7
Joined: Thu, 15. Oct 09, 05:58
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by kyrnn » Sat, 13. Apr 19, 18:13

Yeah, I have 3 or 4 on AutoTrader and all show same as the screenshot that I posted. Also, when I made a new trading ship, the AutoTrader is not even on the comm so I couldn't start AutoTrader with the new trading ship either.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Sat, 13. Apr 19, 20:18

I've tested it with the latest version (2.21) of X4 and it works fine with existing AutoTraders and also with new ships.

It seems you had no problems when starting the AutoTrade on your 3-4 ships initially, which mean you had the option (otherwise you could not have started them). At some point the option did not show anymore which bares the question what has changed. To narrow down the problem could you please check if any other mod you may have installed after starting up the last AutoTrader is causing this? Just disable the "other" mod(s) and see if you still cannot get the option on "Comm".

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Sat, 13. Apr 19, 20:27

Kalypzo wrote:
Thu, 11. Apr 19, 15:25
euclid wrote:
Thu, 11. Apr 19, 14:55
I've checked the code and can't see anything obvious that could cause that. Will need to do some in-game testing.

Concerning your question: Just put $Level = 0 for no fee.

Cheers Euclid
Don't mind the fee, it doesn't break the game
Thanks for the info, and well done
I've tested it in-game with version 2.21 of X4 and found no problems. For example one of my AutoTraders bought spaceweed for Cr 114,928 and sold it for Cr 229,203 for a profit of Cr 107,398 where the commission charge of Cr 6,877 was already deducted. If you still encounter that problem please feel free to load up your saved game (for example dropbox) and let me know the link. I'm happy to take a closer look. Please also mention all other mods you are using.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

kyrnn
Posts: 7
Joined: Thu, 15. Oct 09, 05:58
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by kyrnn » Sun, 14. Apr 19, 04:35

I went to the extensions menu in the game and noticed that there are 2x AutoTrader on the list, I'm not sure how that happened. :gruebel: So, I delete the mod and reinstall the mod and now it's working fine. Sorry for all of the trouble!

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by euclid » Sun, 14. Apr 19, 13:01

No problem, I'm glad you've found it ;-)

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Endeavour79
Posts: 287
Joined: Fri, 29. Nov 13, 23:14
x4

Re: [MOD] AutoTrader with Options ver. 0.7 Feb. 18, 2019

Post by Endeavour79 » Mon, 10. Jun 19, 03:57

Hi Euclid,
Have you tested SETA mode with Autotrader? I'm noticing a large number of negative profit trades (substantial) when having say 10 Trader running and staying in SETA.
Do you have a recommendation how to avoid the trades at loss?
Cheers, End

Post Reply

Return to “X4: Foundations - Scripts and Modding”