[SCRIPT] Manual Trade Extension v2.3.1 [2010-10-02]

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

[SCRIPT] Manual Trade Extension v2.3.1 [2010-10-02]

Post by ThisIsHarsh » Tue, 18. Nov 08, 17:01

Manual Trade Extension

:arrow: Adds a new command to the Trade menu: "Best buy/sell loop". Uses straightforward best buy/sell in a loop, but with some advanced extras, such as trading more than one ware, trading from a parent storage ship, and prioritising player-owned stations as sources.


:arrow: Required: JSON parser library v1.1 (thread)

:arrow: Download: Manual Trade Extension


:arrow: Config menu example (jpg)

:arrow: Details:
  • When you start the command a menu will appear. The core of Manual Trade Extension is the buy and sell lists. In the simplest mode of operation you can just add a ware to both lists and the freighter will repeatedly best buy then best sell that ware, refueling as necessary if jumpdrive is available, autojump is enabled and refuel settings configured.
  • Requires: Trading System Extension; Trade Command Software MK1; Best Buys Locator, Best Selling Price Locator; Transporter Device (optional - for using homebase ship as depot).
  • The buy and sell lists can be configured independently. You can then simultaneously trade in a ware, stockpile another ware and sell off excess wares.
  • You can specify for each individual ware whether it should be bought/sold at below/above average price, or any price.
  • You may specify a list of your own stations/ships that are to be used as preferred sources for buying wares. Then individually set each ware to restrict it's purchase to preferred sources.
  • You can buy/sell from a homebase ship, provided the freighter has a Transporter Device. This means wares will be dropped off/picked up from the homebase ship after each round of purchases/sales.
  • Wares using the most volume in the cargo bay are generally sold off first. Conversely, wares using the least volume are bought up first.
  • Some examples of how this can be used:
    • Independent trader, buying then selling the same set of wares over and over.
    • Easily selling off scavenged wares.
    • Continuously buying up and stockpiling rare wares whenever they become available.
    • Keeping a carrier fully stocked with equipment from your own factories.
    • Network of traders using a larger 'hub' ship as a storage depot.
  • The way the freighter works its way through the buy/sell lists is as follows:
    1. The freighter goes through each item on the buy list in turn, attempting to purchase it. If "Buy until full" is disabled, then the freighter immediately switches to the sell list, otherwise the freighter will keep cycling through the buy list until it can't buy any more, for whatever reason.
    2. The freighter will then go to drop off it's wares at it's homebase ship, if applicable.
    3. The freighter then goes through the sell list. If buying/selling from its homebase, the freighter will take one ware at a time and return to dump unsold wares and pick up the next ware in the list. If "Sell until empty" is disabled, then the freighter will just do one loop through the sell list before returning to the buy list, otherwise the freighter will keep cycling through the sell list until it can't sell any more, for whatever reason.

Changelog
v2.3.1:
- Fixed: bug in menu "homebase max storage" only editing first option.
v2.3:
- Modifed: new menu system.
- Fixed: issues with trading energy cells.
v2.1.1:
- Fixed: workaround for issue with stock !lib.get.bestbuy/sell exclusion sectors.
v2.1:
- Added: 'buy until full' and 'sell until empty' options.
- Added: 'refuel from homebase' option.
- Added: tasks (buy only, sell only, buy + sell).
v2.0.1:
- Fixed: minor issue - added handling of null station return from lib.best scripts.
v2.0:
- Complete revamp, initial release.
v1.0:
- Initial release.
Last edited by ThisIsHarsh on Sat, 2. Oct 10, 20:44, edited 18 times in total.

999-JAY-999
Posts: 622
Joined: Mon, 7. Apr 03, 16:29
x3tc

Post by 999-JAY-999 » Tue, 18. Nov 08, 21:14

Hot off the press comes another fab script !
System Spec :-

AMD Athlon(tm) 64 Duel 6000+ (3.01GHz)
Windows XP Home Ed. SP 3
ATI Radeon HD 4850 (512)
Creative X-FI Soundard
2.00 GB of RAM
G9 RAZOR Mouse

User avatar
corhen
Posts: 338
Joined: Thu, 16. Oct 08, 08:45
x3tc

Post by corhen » Tue, 18. Nov 08, 21:59

sounds great, look forward to trying it out

Keep up the good work

User avatar
juanitierno
Posts: 451
Joined: Fri, 28. Dec 07, 17:06
xrvr

Post by juanitierno » Wed, 19. Nov 08, 01:44

whats the difference with the "manual trade run" command (i think supply software gives it) with the "repeat forever" option?

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Wed, 19. Nov 08, 02:19

juanitierno wrote:whats the difference with the "manual trade run" command (i think supply software gives it) with the "repeat forever" option?
Manual trade run continuously buys and sells at the same two stations over and over. It also doesn't automatically refuel ecells.

This script searches for the station with the best price to buy/sell at in all sectors where you have property (e.g. satellite network). It also automatically refuels ecells as necessary.

PaulP
Posts: 186
Joined: Tue, 18. Nov 08, 00:50
x4

Post by PaulP » Sat, 22. Nov 08, 18:06

Why does this have two t files? 7103-L044.xml and 7103.xml, both are english and exactly the same inside.

Should I delete one of them?

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Sat, 22. Nov 08, 18:28

PaulP wrote:Why does this have two t files? 7103-L044.xml and 7103.xml, both are english and exactly the same inside.

Should I delete one of them?
7103.xml is packaged. The plugin manager automatically copies+renames it, asssumedly to whatever language you are using (english being L044). It is safe to delete one of them, but not necessary.

All future versions of my scripts I'll package with the -L044 there straight away, so perhaps best to delete the 7103.xml, but it really doesn't matter which you delete or if you don't delete at all.

PaulP
Posts: 186
Joined: Tue, 18. Nov 08, 00:50
x4

Post by PaulP » Tue, 2. Dec 08, 04:22

Haha, just playing around with it I made it so that this script used my Gateless Jumpdrive.

Talk about overpowered... the combination of the two scripts is just ridiculous. The ship jumps directly to a station, docks within about 20 seconds, jumps to the next station, docks within about 20 seconds. Even with the minor delays in buying and such the trader is probably doing a complete buy/sell every minute.

I was thinking about making a modification of the move scripts to make ships use the GJD when their auto jump was on and minimum jumps was set to 0, but after seeing this I'm thinking it would be too unbalancing.

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Tue, 2. Dec 08, 04:44

Yeah I try to avoid scripts which modify the game mechanics to such a degree in general, not least for the reason you just mentioned. If you were to make such a change, you would have to balance it in other ways.

Already a lot of my freighters are on standby most of the time because they have milked the profits to be had for the given ware dry.

rascalcmos
Posts: 6
Joined: Mon, 12. Jan 04, 10:07

WANTED: Repeat "Remote Best Buy"/"Remote Best Sell" Script

Post by rascalcmos » Fri, 9. Jan 09, 19:00

EDIT: found it here:
http://forum.egosoft.com/viewtopic.php? ... ght=repeat

Hi,

I know this script exists (I remeber seeing it) - it basically consists in being able to repeat the "Remote Best Buy"/"Remote Best Sell" for a given product...

Problem is: I can no longer find it (tried the search without success).

The "Queue Command" script would be fine - but it doesn't seem to work yet with the 1.4 version I am using?

Thanks for pointing me to that script.

Rascal


{You did find, so I did merge. jlehtone}

Crapgame
Posts: 130
Joined: Sat, 3. Jan 09, 15:03
x3tc

Re: [SCRIPT] Manual Trade Extension: Best buy/sell loop v1.0 [2008-11-18]

Post by Crapgame » Mon, 26. Jan 09, 16:13

ThisIsHarsh wrote: :arrow: The ship will only buy at less than the ware's default price and only sell at equal to or greater than the default price.
I'm missing something here.

Where do I set this "default price"?

:arrow: I have a properly equipped freighter.

:arrow: I select best/sell loop from his trade window. It asks me to select a sector which I do. It asks me to select a station which I do.

:arrow: Then it asks me to select a ware and it lists both the product and the required resources for that station. Lets use a Solar Plant for example. It will ask me to select E-Cells or Crystals.

:arrow: If I select e-cells it just goes on it's way. Where exactly, I'm not sure.

Where do I select this "default price"?

How far away will it go to sell this load?

What if there is another solar plant in the same sector that offers a lower price, will he start going there?

If I select crystals, I assume he'll go buy crystals at the best price and bring them back here. How far will he go for that?

When he buys ecells for jump fuel, how much will he buy?

Does this not work if your have the Trade Command MK3 software installed? I tried to set one of my STs to do this and the command doesn't show.

Is there a limit to how far he'll go? I set one to buy Teladianium and he's just idling. Granted, there is no Teladianium in that sector to buy, but I assumed he'd go find some.

Crapgame
Posts: 130
Joined: Sat, 3. Jan 09, 15:03
x3tc

Post by Crapgame » Wed, 28. Jan 09, 23:10

Anyone using this script know?

User avatar
apricotslice
Posts: 14129
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Thu, 29. Jan 09, 03:31

The price would be whatever you set on the factory sell/buy price.

The jump range is set on the factory as well.

Not using it, so cant answer any of the other questions.

Re UT though, one would need to check that the command slots being used didnt conflict.

Crapgame
Posts: 130
Joined: Sat, 3. Jan 09, 15:03
x3tc

Post by Crapgame » Thu, 29. Jan 09, 13:09

So I have to OWN the factory?

I didn't get that from the original explanation.

User avatar
apricotslice
Posts: 14129
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Thu, 29. Jan 09, 13:15

:lol:

Sorry, cant help it, but that made my day ! :D

Crapgame
Posts: 130
Joined: Sat, 3. Jan 09, 15:03
x3tc

Post by Crapgame » Thu, 29. Jan 09, 13:33

Yep, I just reread the original post and it most certainly does not mention that you need to be the owner of one of the factories in question.

Why wouldn't I just use a CAG?

User avatar
apricotslice
Posts: 14129
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Thu, 29. Jan 09, 13:40

A CAG also requires you own the station. CAG buys or sells from a specific station.

As apposed to UT which trades whereever it feels like it.

Most of the trader scripts are designed for player stations. They need to be based at one before they can do anything.

Crapgame
Posts: 130
Joined: Sat, 3. Jan 09, 15:03
x3tc

Post by Crapgame » Thu, 29. Jan 09, 15:09

apricotslice wrote:A CAG also requires you own the station. CAG buys or sells from a specific station.
Understood, which is why I was looking at this script. Since it didn't mention player ownership of the station.

Thanks.

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Re: [SCRIPT] Manual Trade Extension: Best buy/sell loop v1.0 [2008-11-18]

Post by ThisIsHarsh » Sun, 1. Feb 09, 22:56

Sorry this has taken so long to get a reply. I've been away from X3TC for a while and likely will for a while yet. Anyone else has any issues with my scripts, please PM me, then I'll get an e-mail notifying me, otherwise I wont see forum posts for a while probably.

Anyway:

Firstly, this script has nothing to do with the ship being owned by a station. The only effect the ship belonging to a station will have is that it will use the stations money instead of the players. I think.
Crapgame wrote:Where do I set this "default price"?
Every ware in the game has an average, minimum and maximum price that is hardcoded. Here "default" = "average", I didn't want to say "average" because that might imply it scans for the average price when it doesn't, it simply uses the hardcoded average price.
Crapgame wrote:What if there is another solar plant in the same sector that offers a lower price, will he start going there?
Once the ship has it's mind set on a destination it will go there, even if the station suddenly changes in stock to make it a worse buy/sell. However, once docked he will check the price is equal or better before the final purchase.
Crapgame wrote:If I select crystals, I assume he'll go buy crystals at the best price and bring them back here. How far will he go for that?
Crapgame wrote:Is there a limit to how far he'll go? I set one to buy Teladianium and he's just idling. Granted, there is no Teladianium in that sector to buy, but I assumed he'd go find some.
He will go buy crystals at best price then go sell them at best price and keep looping like that. He will travel as far as necessary (I think it's actually a radius of 50 jumps, which is as big as the galaxy anyway). He won't travel to sectors without a satellite or other property to tell him the prices. If there are a lot of sectors to look through it may take some time since it has to search all viable stations.
Crapgame wrote:When he buys ecells for jump fuel, how much will he buy?
This is determined by refuel settings in the command console. The refuel settings are based on 'jumpsworths' of fuel (so a setting of 5 is enough fuel for 5 jumps). The actual amount used by this script is I think 3x the setting in the command console. Once the ship goes below 1x the refuel setting he will refuel to 3x again.
Crapgame wrote:Does this not work if your have the Trade Command MK3 software installed? I tried to set one of my STs to do this and the command doesn't show.
IIRC it should work, the only possibility is a command slot conflict, which there shouldn't be since MK3 is signed. Not much I can do about it at the moment, but I've noted to check it out when I can.


Hope that all helps.

Dark Kyro
Posts: 19
Joined: Tue, 6. Mar 07, 21:30

Post by Dark Kyro » Mon, 18. May 09, 15:34

ThisIsHarsh

Personally I see no point in your script. Well, maybe stimulating NPC economy by trading E-Cells, but they have so many traders now that this is not necessary.

But IF you made 2 seprarate commands instead - best buy loop and best sell loop, it would be great !!!
Why this is so much better ?

a) Best buy loop
You set the amount of money to spend or number of products to purchase. Great for supplying fleet, or buing rare wares.
a) Best sell loop
You just select the product (or multiple). Great for selling all the trophys you get from captured ships.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”