EnglishGermanFrenchRussianItalianSpanish
Log inRegister
 
[Script] Cargo Delivery Service V1.04 07/01/06 (July 1)
Post new topic Reply to topic Goto page 1, 2, 3, 4, 5, 6  Next
View previous topic :: View next topic

What do you think?
Excellent
71%
 71%  [ 90 ]
Good
19%
 19%  [ 24 ]
OK
3%
 3%  [ 5 ]
Poor
1%
 1%  [ 2 ]
Terrible
0%
 0%  [ 0 ]
Not really my thing
3%
 3%  [ 5 ]
Total Votes : 126

Author Message
klaatu





Joined: 21 Nov 2003
Posts: 304 on topic
Location: Ceti-Alpha 5
Thank you for registering your game
modified
PostPosted: Tue, 31. Jan 06, 18:18    Post subject: [Script] Cargo Delivery Service V1.04 07/01/06 (July 1) Reply with quote Print

Note: Originally written by Jimmy Jazz (Jimmy.Jazz@Schattenseite.de) and called Freight Logistics Software, he has graciously allowed me to continue development, as he did not have the time for further updates. This plugin is an attempt to continue that initial work, as well as to teach myself X3 scripting (this is my first foray into scripting in X3).
--------------------------------------------------------------------------

Cargo Delivery Service

Trade Software for the Industrial Mogul

Download V1.04 from here

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

Description:
Adds two new commands to the ship's Trade Menu:

* One Way Delivery: Delivers a ware from one of your stations to another and returns empty. This it will do forever and ever and ever….

* Two Way Delivery: Delivers a ware from one of your stations to another and returns with a second ware. This it will do forever and ever and ever….

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 is 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 your ship 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 XScript Installer by Cycrow from here 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 either command. 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 [1Way] or b) one ware from one station to another and a second ware from that station back to the first [2Way], until told otherwise.
  • Report the status of the ship as it goes about its work.
  • Indicates the ship's current destination.
  • Restarts itself in the event of a new version, so no need to reissue orders to already assigned freighters.
  • The last 10% of a station's stock is off limits to the CDS freighters.
  • Freighters wait until they can haul at least 25% of their capacity before venturing forth.
  • Built-in intelligence avoids a deadlock in case a 2-Way freighter can't load that 25%.
  • Jumpdrives are used if present. The necessary energy is taken from the departing station automatically.
  • Cargo is transferred among the stations without any credit changing hands. The only expense is the fuel for the jumpdrive (if present).




Last edited by klaatu on Sun, 2. Jul 06, 01:40; edited 4 times in total
Back to top
View user's profile Send private message
klaatu





Joined: 21 Nov 2003
Posts: 304 on topic
Location: Ceti-Alpha 5
Thank you for registering your game
modified
PostPosted: Tue, 31. Jan 06, 18:18    Post subject: Reply with quote Print

Version History:
1.04-

  • Freighter now waits for 25% (was 10%) of its cargo bay to be full before heading out.

1.03-

  • Added: 10% of a station's stock of any ware is off-limits to the CDS freighter.
  • Change: [1Way] Freighter waits for 10% of its cargo bay to be full before heading to the other station
  • Change: [2Way] Freighter waits for the same 10% to be in stock, *unless* the other station has (10% of its max stock + 10% of the freighter's max stock) of the other ware (and the current station can take the 10% of the freighter's max stock), in which case the freighter simply loads what's available (if any) and heads for the other station.
  • Added: Freighters use jumpdrives if present. They will take the needed Energy Cells from the station they are departing from. They do not jump within a single sector.


1.02-
Initial release

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

Next Steps / Currently Working On:
Seems feature complete to me. Any ideas for improvement? Bug reports?

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

Conflict section:
This script uses the following command slots:
<t id="458">COMMAND_CARGO_DELIVERY_ONE</t>
<t id="459">COMMAND_CARGO_DELIVERY_TWO</t>
Text files used:
8316

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

Previous versions:
Download: V1.03 from here, and V1.02 from here

Zip version:
You can download a zip version of V1.04 from here.



Last edited by klaatu on Sun, 2. Jul 06, 01:36; edited 5 times in total
Back to top
View user's profile Send private message
djssuk





Joined: 11 Dec 2003
Posts: 183 on topic

Thank you for registering your game
PostPosted: Tue, 31. Jan 06, 18:42    Post subject: Reply with quote Print

I have used this a lot for transporting ore and silicon and energy and I am delighted you have made the changes and look forward to the jumping option... hope it is soon Razz

Back to top
View user's profile Send private message
Khaakbuster





Joined: 08 Jan 2006
Posts: 377 on topic

Thank you for registering your game
PostPosted: Tue, 31. Jan 06, 21:13    Post subject: Reply with quote Print

Thanx for picking up the work of Jimmy. I really need this script for my self supplying complexes. It would be great if you could add a function soon, where the freighter would be forced to leave some of the resources in the factorys to prevent them from bleeding out.

My freighters always pick up all the energy cells from my complexes and deliver them to the mines and leave nothing for the complexes to work with. Sad

Back to top
View user's profile Send private message
klaatu





Joined: 21 Nov 2003
Posts: 304 on topic
Location: Ceti-Alpha 5
Thank you for registering your game
PostPosted: Tue, 31. Jan 06, 21:47    Post subject: Reply with quote Print

Khaakbuster wrote:
It would be great if you could add a function soon, where the freighter would be forced to leave some of the resources in the factorys to prevent them from bleeding out.


Yes, I think that'll be the next thing I work on. Sounds easier to do than adding jump capability anyway. Smile

Would you agree that leaving 10% of the station/complex's stock of whatever off limits to the CDS freighters would be a good starting point? This would be true of any station it's working with, so even a mine would have 10% of its stock (minimum) on hand at all times.

Should frieghters wait for a certain percentage of their cargo holds to become filled before heading out? This is easier done on a one-way delivery than a two-way, as the freighter may be waiting at one end for a supply from that station, but the station on the other end is either in need of what the freighter would bring or is full of what it will pick up. This deadlock wouldn't be true of a one-way delivery. As it's coded now on the one-way the freighter will not head out until it has at least something to transport, even if it's only one unit. The two-way heads out regardless of if it was able to pick up any cargo or not, since the station may be in need of what's being transported from the other end.


_________________
"It's so simple. No, wait--it's needlessly complex!"
- Homer Simpson
You need this!: Cargo Delivery Service
Back to top
View user's profile Send private message
Fachtna





Joined: 03 Feb 2004
Posts: 717 on topic
Location: Edinburgh, U.K.
Thank you for registering your game
PostPosted: Tue, 31. Jan 06, 23:04    Post subject: Reply with quote Print

10% would be fine

if anyone can do a similiar script, whereby a station trader would sell excess stock to the npc's, that would be good too.

the two would go hand-in-hand. one sorts your factories, one sorts your profits Smile

Back to top
View user's profile Send private message MSN Messenger
Naffarin





Joined: 03 Dec 2005
Posts: 465 on topic

Thank you for registering your game
PostPosted: Tue, 31. Jan 06, 23:19    Post subject: Reply with quote Print

@Fachtna: Take a look here Station Manager by Burianek & AalaarDB

Back to top
View user's profile Send private message
Khaakbuster





Joined: 08 Jan 2006
Posts: 377 on topic

Thank you for registering your game
PostPosted: Tue, 31. Jan 06, 23:38    Post subject: Reply with quote Print

I think that 10% is a good value. I checked my biggest complex and it has a capacity for 225k energy cells and about 15k to 25k units of other small goods. So the 10% would be just 22k cells and about 2k units of the goods which is a comfortable rest.


I would recommend a solution where the frighter would wait for a certain amount of goods before heading out.


Another question really troubles me. If the destination is already full of the supplies which we want to bring there, lets say we want to bring silizium from the mine to a SPP, will the freighter take a full hold of silizium, dock at the SPP and be unable to take energy cells back to the mine because its hold is still blocked?
For such a situation the check for a certain amount of goods to transport would be good, because the freighter would have to wait for enough cells to be put into its hold while unloading silizium at the same time.
Do you understand what I mean? It's probably a little complicated to program.

I guess a more simple solution to this problem might be, that when loading the supplies you check that you only load so much supplies that they fit into the hold of the target station.

Back to top
View user's profile Send private message
klaatu





Joined: 21 Nov 2003
Posts: 304 on topic
Location: Ceti-Alpha 5
Thank you for registering your game
PostPosted: Wed, 1. Feb 06, 00:02    Post subject: Reply with quote Print

Yes, currently the freighter only carries as much as the receiving station can hold. The situation you postulate would occur if, for instance, the CDS freighter checks the receiving station and determines that a full load can be taken, so it loads up and heads out. Meanwhile, something else fills up the receiving station with the ware the CDS freighter is bringing, so it can't unload. This would be a bad thing, leading to the end of life as we know it. Smile

(2Way) If the receiving station is already totally full before the CDS freighter heads out, it will transport nothing since it assumes the factory it's leaving from will need the other ware it will be picking up at that other station. Placing a check for a minimum to transport could hold up the exchange of one ware at the expense of the other.

In the one-way situation the above hold up would not occur since there is only one ware being transported and placing a minimum of, say, 10% of the freighter's cargo bay could be beneficial. With the current version there is a minimum of 1 unit. Changing it to a certain percent of freighter's cargo bay would be trivial.


_________________
"It's so simple. No, wait--it's needlessly complex!"
- Homer Simpson
You need this!: Cargo Delivery Service
Back to top
View user's profile Send private message
Khaakbuster





Joined: 08 Jan 2006
Posts: 377 on topic

Thank you for registering your game
PostPosted: Wed, 1. Feb 06, 01:18    Post subject: Reply with quote Print

I'm glad to hear that your script already checks for enough free space at the destination. I haven't had a problem with this so far, but one of my mines is producing silizium like crazy and I was afraid of a deadlock to come. Surprised


Changing the minimum amount to transport from 1 unit to 10% would be very nice.


In the end it's your decisions to make, I can just tell you my wishes. Smile

1. Leave station only if at least 10% cargo space is used for the goods.
2. Leave at least 10% of the selected source goods at the supplying station.

Back to top
View user's profile Send private message
Mobuj



MEDALMEDAL

Joined: 23 Nov 2005
Posts: 264 on topic
Location: Canada
Thank you for registering your game
PostPosted: Wed, 1. Feb 06, 02:05    Post subject: Reply with quote Print

Hi Klatuu

This is a FAB script!

You should get it posted to the "Index of Community Scripts / Mods for X3".

Sure is gonna be a life saver. Cool


_________________
---------------------------
I am Popeye of Borg
You will be askimilated!
Back to top
View user's profile Send private message
Jimmy Jazz





Joined: 04 Jun 2003
Posts: 738 on topic
Location: Berlin
Thank you for registering your game
PostPosted: Wed, 1. Feb 06, 13:53    Post subject: Reply with quote Print

@Klaatu: Thank you for taking over the work.

I linked your thread to my original one, so that all the new user find your improved version

If you have any questions concerning the original code, just contact me. When I wrote the code I didn't get the comment function to work, but I tried to make the code self-explanatory.


_________________
Pinky : "Gee, Brain what do you want to do tonight?"
Brain : "The same thing we do every night Pinky. Try to take over the world!"
Back to top
View user's profile Send private message
klaatu





Joined: 21 Nov 2003
Posts: 304 on topic
Location: Ceti-Alpha 5
Thank you for registering your game
modified
PostPosted: Wed, 1. Feb 06, 17:52    Post subject: Reply with quote Print

You're welcome Jimmy, and thanks for the original version; it was very helpful in making self-sufficient complexes when silicon or ore was not close by. The code itself was very readable; of course, I've had more than a few years practice. Smile

Regarding the issue of waiting for a minimum amount to haul: Jimmy was right to be very conservative here, as a deadlock can occur fairly easily if a silicon mine has little silicon waiting for transport and also has no energy to produce more. If a CDS freighter is the only freighter maintaining the station so is expected to bring it energy on its return trip, waiting to load 10% of its cargo bay with silicon will cause it to wait forever. This situation needs to be avoided, so more is needed than just a wait for a minimum load.

Here's the way I've implemented it in the version I'm testing now:

10% of a station's stock of any ware is off-limits to the CDS freighter, so it'll never touch a station's last bit of stock. This is true for both one and two-way CDS freighters. Also true for both is that the freighter will never haul more than the other station could take (at the time of loading).

For the one-way version the freighter simply waits for 10% of its cargo bay to be full before heading to the other station. This means the station must have (10% of station's max stock + 10% of the freighter's max stock) on hand before the freighter will load.

For the two-way version the freighter waits for the same amount to be in stock, unless the other station has (10% of its max stock + 10% of the freighter's max stock) of the other ware (and the current station can take the 10% of the freighter's max stock), in which case the freighter simply loads what's available (if any) and heads for the other station.

This prevents the above deadlock from occurring since it looks at both stations to see if there's something it could be hauling, and if there is it heads there.

If, after some more testing, it appears that things are functioning as designed, I'll be releasing it. Unless someone sees a flaw in my logic or has a better idea. Speak up if so.



Last edited by klaatu on Thu, 2. Feb 06, 17:58; edited 1 time in total
Back to top
View user's profile Send private message
Khaakbuster





Joined: 08 Jan 2006
Posts: 377 on topic

Thank you for registering your game
PostPosted: Wed, 1. Feb 06, 18:53    Post subject: Reply with quote Print

klaatu wrote:

Here's the way I've implemented it in the version I'm testing now:

10% of a station's stock of any ware is off-limits to the CDS freighter, so it'll never touch a station's last bit of stock. This is true for both one and two-way CDS freighters. Also true for both is that the freighter will never haul more than the other station could take (at the time of loading).


This alone would make it worth releasing. Please hand it over. Very Happy


klaatu wrote:

For the one-way version the freighter simply waits for 10% of its cargo bay to be full before heading to the other station. This means the station must have (10% of station's max stock + 10% of the freighter's max stock) on hand before the freighter will load.


Ok, there can be no deadlock in this scenario. I'm already thinking about using two freighters with one way delivery to minimize traffic... Wink


klaatu wrote:

For the two-way version the freighter waits for the same amount to be in stock, unless the other station has (10% of its max stock + 10% of the freighter's max stock) of the other ware (and the current station can take the 10% of the freighter's max stock), in which case the freighter simply loads what's available (if any) and heads for the other station.


Interesting solution! Sounds perfect to me, although it could mean a few more runs of the freighter but better have more runs than a deadlock.

Back to top
View user's profile Send private message
whiteraider



MEDALMEDAL

Joined: 07 Mar 2004
Posts: 499 on topic

Thank you for registering your game
PostPosted: Thu, 2. Feb 06, 11:41    Post subject: Reply with quote Print

Have used JimmyJazz's version and like it so I'm assuming it'll pick up from that. Going to test it later Smile

One thing I've not seen anyone do is a deliver to NPC Equipment Dock, for goods that they dont sell e.g.
AIREs in Antigone Memorial, so a frieghter (M4) could wait for x items then take them to the EQ and sell, returning home empty


_________________
Bring back the TS Pirate Ship, I miss my liberated fleet runing around the universe Twisted Evil
Maybe a fleet of liberated Pirate Ship Super Freighters Rolling Eyes

"Priests Dukes Compliments... Here is ship!"
"Teladi now show you how to fight... Ship all yours! Dont kill Teladi!"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2, 3, 4, 5, 6  Next
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Sun, 19. Aug 18, 17:34

All times are GMT + 2 Hours

[ Disclaimer / Impressum ] | [ Privacy Policy / Datenschutz ]

Board Security

Copyright © EGOSOFT 1989-2018
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.20829 seconds, sql queries = 31