[SCR] Cargo Delivery Service 2.02 : 03/02/09

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

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

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

[SCR] Cargo Delivery Service 2.02 : 03/02/09

Post by klaatu » Tue, 27. Jan 09, 19:36

Cargo Delivery Service

DISCLAIMER: feel free to use this script in whole or in part any way you like, with due credit.

Trade Software for the Industrial Mogul

[ external image ] V2.02 here.

Access through the ship's Trade menu, Trade Software Mark II required.

Description:
Adds one new command to the ship's Trade Menu: Cargo Delivery Service

Why do I need this?
Imagine you have an industrial complex that needs silicon and a silicon mine that needs energy. With CDS you can assign a freighter to deliver energy from your complex to the mine and return with the silicon. No money need be involved. This way you can give the mine zero credits and it will work nevertheless. Industrial complexes can now become truly self sufficient even without being connected to a mine.
The software does not discriminate between products and resources. This means you can load energy cells from a complex although it uses it as a resource.

When does it stop working?:
If the hull of the freighter drops below 80% or if one of the stations is destroyed it will fly to the nearest shipyard and send you a message.

Installation:
You need the [http://forum.egosoft.com/viewtopic.php?t=265915]Plugin Manager by Cycrow[/url] to install this plugin. Use Cycrow's installer to place the files from the .spk into your game. The next time you start the game, you should see the commands in the trade menu.

Uninstallation:
Stop all freighters currently using the CDS command. Save and exit from X3TC. Use Cyrow's installer to remove the files placed into the \scripts and \t folders.

--------------------------------------------------------------------------

Features:
  • Freighter transports a) one ware from one player-owned station to another [1-Way] or b) one ware from one station to another and a second ware from that station back to the first [2-Way], until told otherwise.
  • Report the status of the ship as it goes about its work. Indicates the ship's current destination, and what ware is being bought/loaded or sold/unloaded.
  • Restarts itself in the event of a new version, so no need to reissue orders to already assigned freighters.
  • The last x% of a station's stock (configurable) is off limits to the CDS freighters.
  • Freighters wait until they can haul at least x% of their capacity (configurable) before venturing forth.
  • Built-in intelligence avoids a deadlock in case a 2-Way freighter can't load that x%.
  • Jumpdrives are used if present. The necessary energy is taken from the departing station automatically.
  • Option to allow cargo to be transferred among the stations without any credit changing hands. The only expense is the fuel for the jumpdrive (if present).
Plain zip version available here, for those who wish it.

If anyone wants to translate this to another language, feel free to send me the translated t file and I'll be happy to include it in the spk/zip.
Last edited by klaatu on Sat, 16. Jan 10, 09:42, edited 9 times in total.
"It's so simple. No, wait--it's needlessly complex!"
- Homer Simpson
You need this!: Cargo Delivery Service

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Tue, 27. Jan 09, 19:37

Version History:

2.02 - 03/02/09
  • freighters now load available product from the factory every minute or so, to allow the loading of more product than a factory can stock
  • improved error checking, cleaner code
2.01 - 29/01/09
  • minor bug fix for 2-way: 2nd ware getting reset to null
  • will now wait for at least one unit of ware if %>0
2.00 - new version for X3: Terran Conflict only. Incompatible with X3: The Reunion
  • a new menu system allows more configuration than ever before
  • percent of a station's stock that is off-limits can be set individually for each ship
  • percent of the ship's hold that must be filled before continuing can also be individually set for each ship
  • honors stock limits set by dockware manager script
  • new option allows either loading/unloading cargo or buying/selling
Last edited by klaatu on Wed, 4. Feb 09, 03:33, edited 3 times in total.

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

Post by apricotslice » Wed, 28. Jan 09, 00:26

Does this include delivery to the PHQ and the HUB ?

If I remember rightly, the R version didnt work with the PHQ.

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Wed, 28. Jan 09, 02:42

Seems to work fine for me delivering to the PHQ; I have 2 M5's hauling Microchips and Cloth Rimes between a complex of mine and my PHQ. I haven't tried to the hub, but I'll try now.

Edit: Just finished testing with a delivery to the hub: delivery was successful as expected. No problems seen.
Last edited by klaatu on Wed, 28. Jan 09, 03:39, edited 1 time in total.

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

Post by apricotslice » Wed, 28. Jan 09, 02:47

Great :)

I've added the spk to my download site as a mirror. Hope thats ok with you.

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Wed, 28. Jan 09, 03:51

I don't mind, especially if you update your mirror site if and when a new version is released. If you don't, well, I guess it's OK anyway.

While testing delivery to the hub I did notice one small issue I'll correct in the next update: if the percent to haul value is set too small, the minimum number to haul can end up being zero, which means the ship sets off to the other station with nothing in its cargo bay. Easily prevented by having the minimum percent to haul be greater than whatever percent a single ware takes up in the cargo hold, but the next version will make sure it hauls at least one unit of the ware if it can (unless a deadlock would be created in doing so).

MenzAgitat
Posts: 5
Joined: Thu, 10. Jan 08, 22:17
x4

Post by MenzAgitat » Wed, 28. Jan 09, 13:07

I'm using Commodity Logistics Software (CLS) by Lucike. Does your script bring additional features ?

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

Post by apricotslice » Wed, 28. Jan 09, 13:10

This is a lot simpler. Its designed for repetitive movement of wares between your stations without money involved.

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Wed, 28. Jan 09, 15:48

While I like Lucike's CLS very much, and use it extensively, for the life of me I could not get it to do some of the very simple jobs I wanted it to do. I don't know why, but for some reason CLS would not deliver Microchips or Cloth Rimes to my PHQ. It would pick them up, but wouldn't drop them off. I couldn't tell you if it was something specific to my game that caused it, but nevertheless I needed something that would do this simple job. I had written CDS for Reunion and I knew it could do it, so I rewrote it for TC.

I quite like how it turned out, with the new menu system and all.

richardh
Posts: 67
Joined: Thu, 4. Dec 03, 00:17
x3

Post by richardh » Fri, 30. Jan 09, 01:09

Having a bit of a problem with this.

When configuring the "Station 2" ware, it keeps losing the setting. The freighter never acts on the second ware shipment in "2-way" mode. When I go back into the config menu, the second ware has reverted to "none" from its original setting.

Example:

Station 1: Crystal Fab Complex
Ware: Energy Cells

Station 2: Silicon Mine Complex
Ware: Silicon

Mode: Load/Unload, 2-way

It'll ship the Energy Cells from Station 1 to Station 2, but the 2nd ware will be blank, and no return shipment is ever made (and I've messed with all the percentage settings, and get how they work).

It works just fine 1-way... but I can do that with regular scripts!

Any ideas, klaatu?

Cheers,


Rich

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Fri, 30. Jan 09, 05:03

richardh wrote:Having a bit of a problem with this.
Oops, yep, you're right. I had one line of code in the wrong place. :o

See first post for a version that should fix this problem. Thanks for reporting it. Let me know if you run across any other issues (or if this one somehow isn't fixed for you, though it worked alright when I tested it). A Q/A department of one is too small for adequate testing. :)
"It's so simple. No, wait--it's needlessly complex!"
- Homer Simpson
You need this!: Cargo Delivery Service

richardh
Posts: 67
Joined: Thu, 4. Dec 03, 00:17
x3

Post by richardh » Fri, 30. Jan 09, 05:32

No worries. Will try it tonight

One "nice-to-have" item for this script would be...

If I select the main script's menu option on a freighter that's already running it, that freighter seems to get an instant cease-and-desist. Is that correct? Is it at all possible to avoid resetting the freighter behaviour at that point, as I'd like to simply review cargo delivery settings - without necessarily wanting it to stop/restart. Otherwise, there's no way I know of to find out what the percentage configurations are actually set to - not without shutting down the delivery activity itself.

Rich

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Fri, 30. Jan 09, 16:19

Yeah, I'd like to have that too. I'm sure there must be a way, as I believe Lucike does it with the CLS, EST, and CAG scripts of his. I've looked at those but I sure can't see how he does it. If I ever do, though, I'll definitely be adding that ability to CDS as well. Thanks for the suggestion, and I'm certainly open to any others.
"It's so simple. No, wait--it's needlessly complex!"
- Homer Simpson
You need this!: Cargo Delivery Service

richardh
Posts: 67
Joined: Thu, 4. Dec 03, 00:17
x3

Post by richardh » Sat, 31. Jan 09, 01:37

The 2-way delivery now works a treat. Nice one.

Rich

DonFü
Posts: 3
Joined: Sat, 31. Jan 09, 13:08

Post by DonFü » Sat, 31. Jan 09, 13:30

Hello,

This script was what i've looked for a long time, thank you for sharing it. But I've got one problem: i cannot select all wares.
I have a complex producing computer parts, those quantum things, micro chips and cystals. And all i could select to transport are the computer parts. The other station is a HQ bought from the Maroudeur.

Any ideas what i'm doing wrong?

Thanks

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

Post by apricotslice » Sat, 31. Jan 09, 13:45

Where is the ship homebased ? That probably effects what it can see.

DonFü
Posts: 3
Joined: Sat, 31. Jan 09, 13:08

Post by DonFü » Sat, 31. Jan 09, 13:57

Hm... I think I just got the problem. Crystals, micro chips and those quantum things are not listed as wares in the HQ!? Maybe the HQ from the Marodeur is broken or i've messed something other up.

Sorry to bother, script works just fine :wink:

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

Post by apricotslice » Sat, 31. Jan 09, 14:39

You may need to manually put one of each on the HQ to get them listed there.

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Sat, 31. Jan 09, 17:30

Yes, you'll only see wares listed that the other station/ED/HQ/etc. has in it's list of wares. So add one of the ware you want to haul from the station to the HQ, then try it.

The homebase of the freighter makes no difference at all. It can be set anywhere, or nowhere and it wouldn't matter in the least to CDS.

As a sidenote, I've been thinking about changing the way wares are loaded. Currently it waits untill it's about to head to the other station before loading the wares. I think certain things would work better if I changed it to load whatever wares the station has in stock (not counting the reserve, of course) every minute or so, then check to see if it should head to the other station. This way you could load many times the station's entire stock size into the freighter if you wanted. As it is now the most you can haul is whatever the size of the station's maximum stock is.

Can anyone think of any cons to making this change?

Hieronymos
Posts: 830
Joined: Fri, 30. Dec 05, 22:14
x3

Post by Hieronymos » Sat, 31. Jan 09, 21:43

Klaatu,
great script. Perfect for non-closed loop complexes, and especially for the PHQ.

Only downside I can see is possibility of freighter clogging up over time with one ware, preventing carrying of any other(s), if the production:consumption ratios of served fabs/complexes is not equal.

Your current rule: "the most you can haul is whatever the size of the station's maximum stock is." is probably the best solution to this.

But doesn't scale particularly well if freighter is small, and served complex is huge (with huge max stock levels).
............

Does this script also serve multiple freighters serving same fab<--->mine??

Or serve multiple freighters serving same complex, but different secondary fabs/mines?

Post Reply

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