[SCRIPT] Universe Autotrader (Tarde Software MK3 extension)

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
-IH-
Posts: 20
Joined: Tue, 5. Dec 06, 22:27
x3

[SCRIPT] Universe Autotrader (Tarde Software MK3 extension)

Post by -IH- » Fri, 9. Feb 07, 18:44

AutoTrader (AT)
Version 0.11
Languages: Russian, English
Engine version: 32
Tested in: 2.0.02
Download: http://www.real4x.ru/x3/at/auto_trader.rar
Download SPK: http://www.real4x.ru/x3/at/auto_trader.spk

This is just another auto trading script (as you may see from the name). Concept of trading scheme was obtained from scripts of VIR_RUS (he is not living at this forum but I have to mention him ;)). The script has some advantages and (of course) disadvantages. Read about them below.

Compatible ship types: TS
Required equipment:
- Trade Software MK3
- Navigation Command Software MK1
- Jump Drive

Features:
- For all money transactions account of owner station is used. If none specified then player main account selected. This is especially useful when you are close to end of game storyline ;)
- In each trading route AT buys as many ware items as it could sell in the Universe. Ware bought at a single station and then sold to several consumers.
- Ware always bought by price equal or lower than average and sold by price equal or higher than average. This guarantees that AT will not waste money but in such scheme some profitable deals could be missed.
- AT always checks ALL the wares and chooses the best of them. Available quantity is taken into account as well as ware price.
- Trading is only performed in sectors that have navigation relay satellites installed (any type). If you add new or remove old satellite the changes will be accepted within 10 minutes.
- Trader always uses Jump Drive ever for moving within one sector. Only distance is taken into account, not jumping cost in credits.
- 10% of cargo bay reserved for Energy Cells. This space cannot be used for trading ware.
- Before trading AT sells all the ware and not installed equipment. Items will be sold by prices not worse than average. If more than one type of ware/equipment could not be sold (no consumers with acceptable prices) then trading will not be started.
- At the beginning of each trade route AT buys full energy reserve. When moving between stations the reserve is controlled to be not less than 1/3 of full capacity. Using such strategy AT makes less runs to solar stations for refueling (and saves time = money) but some times it could run out of cells. If this happens AT jumps to the nearest (to target) sector and continues flying using generic engines. If distance is more than 2 sectors a notification message is sent to player.
- Several traders will coordinate their activity and never start trading the same ware.
- If a trader for 10 minutes cannot find (not "find-and-fly" - just find) acceptable target station for selling ware it postpones the ware and picks another one. If second ware could not be sold too then trader starts "switching" the two wares each 10 minutes until something sold.
- In this script game performance was priority number one. 15 traders (the number that was tested) not make any significant impact to FPS. Payback for this: long calculation time of best route (from 30 seconds to 3 minutes depending on your Universe). Good news: if several traders request best route calculation (that is normal situation when you have 8-10 traders) only one of them will consume game resources, the others will wait and use result of the first. In other words, game performance should not depend on trader number. If it does - send me a PM and I'll try to fix that.
- All trade transactions are counted and recorded. You may request report by any trader (ever inactive) or get summary for all traders. Report includes: name of wares that were sold, income for each ware, total income for all wares and average income per minute (this could be useful when you plan buying something expensive like M1 ;)). NOTE: The statistics command is only available for ships with Trading Software MK3 installed.
- In difference of many other scripts (including standard Universal Trader - UT) this one correctly handles Trading Stations and Equipment Docks. Game engine may only find ware by best price but not by amount of available items. For factories this is not critical since amount and price are closely connected for them but at TS and Docks prices are always fixed. This leads to wrong decisions made by traders. For example, trading of just several items of ware or refuse trading ware at all (as UT does in last fix). Autotrader works in another way and will check each station in sector to ensure that TS or Dock is a really best target.
- AT uses rather verbose displaying of its actions in status line.

Disadvantages:
- If attacked AT continues flying and dies. Yeap, this is a computer - no instinct of self-preservation. If you need “caution AT” - use UT :)
- Sometimes AT runs out of cells and bothers you with notifications. Accept this.
- In spite of UT autotrader cannot repair damaged hull or buy upgrades. This is your duty.
- Equipment docks may buy weapons that they not sell. If you use that than sold weapons just disappear from Universe. This is considered BAD and AT never does such trading. Experience shows this decision is wise and with time Universe become more comfortable since you and NPC convoys always may buy good weapons in docks. Thought, pirates may too :)

Installation: just unpack the archive and copy folders "scripts" and "t" to your game folder. Before copying "t" folder it is strongly recommended to check if you have the same files already. If you do - write me a PM, we will find a workaround.

After the script installed a ship with proper equipment gets two new commands:
- Tarde / Autotrade: Start trading
- Advanced commands / Autotrading: Statistics. When the command executed you are requested for two parameters:
-- rep - show report, second parameter: all - for all traders; cur - for current only.
-- res - reset statistics, second parameter: all - for all traders; cur - for current only.

Different info:
- Average income of a single trader is about 4000-5000Cr. This depends on many factors so estimation is not exact. The most profitable type of wares is weapons but bids/asks for them depend on many factors.
- If after running single trader you start thinking that 10 traders make 10 times more profit you are wrong! :) Only first trader sells "most profitable ware", the others sell worse wares and hence get less profit. Rough estimate: 15 traders make profit in 10 times more than single trader.
- Total number of tradable wares (i.e. wares that could be bought and sold) in the Universe is about 70. Number of wares that could be traded at the same time with profit is about 50. Obviously, you need not more traders than these numbers.

Future plans:
- Restrict trading of a selected ware for a particular trader. This could help in specialization different ship classes (size of cargo and speed) for particular type of wares. If you think this is useful - write please.
- AT could be extended with many missed features of UT (self defense, upgrades/repair, levels and promotion) and complex profit counting algorithm. This requires a lot of efforts and the questions is: Is that the functionality that people want?

Used script commands:
- COMMAND_TYPE_TRADE_56
- COMMAND_TYPE_SHIP_60

Used text file and language page:
- 7456

Version history:
- 0.11, 02.III.2007
- FIX: Trade Software MK3 and Jumpdrive were not considered when checking AT command availablity. I bet some people liked this bug ;)
- FIX: Cells reserve was incorrectly counted when buying ware of volume more than 1.
- FIX: In case of cells shortage message for player contained last passed gate name instead of current sector.
- To upgrade: remove old version and setup new one. Restart of trading command is desired but not required (changes will take effect as soon as AT starts new trade route)

PS. Feel free to correct me (via PM) if any of English resources (including this text) sounds clumsily for native speaker :)
Last edited by -IH- on Fri, 2. Mar 07, 01:08, edited 2 times in total.

Khaak_Slayer
Posts: 388
Joined: Sun, 18. Apr 04, 17:04
x4

Post by Khaak_Slayer » Fri, 9. Feb 07, 20:32

- AT could be extended with many missed features of UT (self defense, upgrades/repair, levels and promotion) and complex profit counting algorithm. This requires a lot of efforts and the questions is: Is that the functionality that people want?
- Very! I was hoping this script would contain such things, so if there is a plan to implement them, please do so. I really think most people would want those added features too.

This sounds very good, i'm going to load it into my game and test it out now.

Thankyou very much for it!

(PS, your English is actually very good for the most part ;D)

Edit: oh, and also, you might consider making an .spk version too, most people here would appreciate it i'm sure. Thanks!

User avatar
Azz
Posts: 1031
Joined: Tue, 18. May 04, 20:14
x4

Post by Azz » Sat, 10. Feb 07, 02:50

This script seems promising ....
(self defense, upgrades/repair, levels and promotion)
adding these feature will be great.. It's the part that i prefer in UT, these features make UT more alive than just ships traveling and buying endlessly...

And yes your english seems good, better than the mine anyway.. :D
iou naud ouate, aille ama pis | Pilote IA | Site

-IH-
Posts: 20
Joined: Tue, 5. Dec 06, 22:27
x3

Post by -IH- » Sun, 11. Feb 07, 00:25

Thanks guys for your feedbacks :)
All right, I'll start making improvements in AT. Though, I doubt they will be quick - currently I'm working on compelx build helper script (trying to make this not like another station positioning cheat but a real game feature).

-IH-
Posts: 20
Joined: Tue, 5. Dec 06, 22:27
x3

Post by -IH- » Sun, 11. Feb 07, 00:56

Khaak_Slayer wrote:Edit: oh, and also, you might consider making an .spk version too, most people here would appreciate it i'm sure.
Done! Thanks for guess.

idont
Posts: 13
Joined: Thu, 11. Jan 07, 19:15
x3tc

Post by idont » Tue, 27. Mar 07, 20:00

Are you still working on this? I have only tried it for a few days, but so far it seems to work far better than the normal UT.
I'd like to echo the request for some of the UT features, like jumping to safety when attacked. I'm not so keen on having the traders slowly upgrade, as I always found slowly grooming Sector Traders to be more tedious than fun.

Some things I noticed:
  • When you calculate the total profit per minute, it will overflow once the total profit is about 35,800,000 credits.
  • Most of the trade runs seem to use only a few thousand space units of the cargo bay, but require far jumps. This means that the traders will be half empty most of the time, and will have to refuel after every trade run. So, it might be better to reserve more space for energy.
  • When buying one ware from a complex, it would be nice if the trader would check if it could also make a profit from the other products available.
  • I noticed that sometimes traders won't buy everything a station is selling. I'm not quite sure why this is, but I think it could be that the trader decides how much to buy before it starts flying to the station, and then ignores the goods newly produced in the time it took to get there.
  • I saw one trader that was trying to sell a load of Wheat, but was beaten to the buying station by some AI trader who completely filed the station. It then sat idle for a while, until eventually it started trading weapons again. Unfortunately it was still almost completely full of wheat, thus only able to make very small trade runs.
    I think it would be nice if once a trader is more than 90% full, it starts selling all the non-equipped stuff, like it does when you first start the script.
Thanks for the work so far, and I hope you will be able to work on this script some more soon.

rafezetter
Posts: 130
Joined: Wed, 25. Jul 07, 22:00
x3

read text msg

Post by rafezetter » Tue, 7. Aug 07, 01:33

Hi _ im getting a readtext2011-430 come up in my special commands section - i think the 430 is the UT one, is there any way i can fix this - I have 2 others i need to deal with as well

sanityO_o
Posts: 4
Joined: Sat, 28. Mar 09, 21:24

Post by sanityO_o » Mon, 6. Apr 09, 00:45

the link's dead :(

Post Reply

Return to “X³: Reunion - Scripts and Modding”