[SCRIPT] Trading Distribution Network V1.01 : Update 04/10/2006

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

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

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

[SCRIPT] Trading Distribution Network V1.01 : Update 04/10/2006

Post by Cycrow » Wed, 27. Sep 06, 19:12

===========================================
Name: X3 Trading Distribution Network
Version: V1.01
Author: Cycrow
Updated: 04/10/2006
===========================================
:arrow: Download Package (spk): Download : Mirror 1
===========================================

This script allows you to distribute goods between trading stations in the universe.
The main advantage of this is that you can spread the wares you make all around the universe allow much better selling opurtunities
You can also use it to have refueling stations, filling it with energy sells will allow you to allows have a store of energy close by.


First you need to create a network, you can have any number of networks you wish.

1. Creating a Network

To create a network, you need to use the Create network command in one of your trading stations command consoles.
This will ask for a name for the network, this can be anything you like as long as its not bene used on your other networks.
Once entered, the network will be created and that station will be added to the network.

2. Adding station to a network

A trading network is only good if you have multiple trading stations conencted to the network. To assign more stations to the network, you use
the add/remove station command from the trading stations command console. Then you select one of the stations already in a network, and the current station
will be joined to that network. If the current station is already in a network, then it will be changed to the new network.

3. Removing station from a network

To remove a station from a network, you need to select the Add/Remove station command from the stations command console. Then select a station
that is in the same network as the current station, ie selecting the current station will remove it. Selecting a station thats in a different network
will cause it change networks rather than being removed complete.

4. Displaying Network Status

There is a station command to display the status of a network, this will display all the stations that are connected to the network, as well
as all the ships assigned to them.

5. Assigning Ships to a network

For a fully functional network, you need to assign at least 1 ship. The ships are used to transfer the goods between the stations. If you install
jumpdrives to the ships, they will take energy from thier current station to use to jump.
To assign the ship, you use the Add/Remove command from the ships command console, its found in the trade menu. You will need to select any station
in a network and the ship will be added to that network, Once added it will fly to one of
the closest stations in the network.

6. Removing Ships from a network

To remove the ship, you need to select the add/remove command from the ships trade menu to remove it from the network.

7. Distribute Goods

To distribute goods between sectors, simple dump them in one of the stations in the network and they will be distribute between the whole network.

8. Future Updates

* Add the ability to add stations and complexs to the network for ships to pick up goods from.
* Add selling ships to the trading stations to allow it to sell all the goods from the stations.
Last edited by Cycrow on Sun, 7. Sep 08, 23:58, edited 2 times in total.

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 21:43
x3tc

Post by djssuk » Wed, 27. Sep 06, 23:08

Genius... this is it. This is something I have been maually fiddling about with all the time to try and maintain overstock...

What a guy... smoke him a kipper, he'll be back for breakfast...

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Thu, 28. Sep 06, 04:08

This is a damn good idea bud :)
But how does it distrubute the goods i.e fill one station up then go to the next or does it just cycle between the stations?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 28. Sep 06, 09:15

if you dump some wares into one station, it works out the average that should be in all stations, then it calls in any free ships to send all the wares to different stations.

ie, say you have 3 trading stations, and you put 30 units of energy cells in one of them, then a ship is called to pick up 20 units and drop of 10 units at the other 2 stations

User avatar
R.Styles
Posts: 261
Joined: Sun, 6. Aug 06, 22:19
x3tc

Post by R.Styles » Thu, 28. Sep 06, 09:24

djssuk wrote:What a guy... smoke him a kipper, he'll be back for breakfast...
Indeed, What would we do without the programming/scripting genius that is cycrow adding more and more to the X universe than even egosoft thought possible.

Augustini
Posts: 1604
Joined: Tue, 13. Dec 05, 21:55
x4

Post by Augustini » Thu, 28. Sep 06, 09:35

If i understand this right, you will still need to have at least 1 Trading Station supplied by an outside ship in order to get new goods in the network.

There is no need to manually place 1 unit of each ware in each trading station in order for the Trade Network Ship (TNS) to distribute the ware ?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 28. Sep 06, 09:45

yeah you need to still put wares into one of the trading stations, but in the next version i will be adding the ability for ships to pick up wares from your stations and bring them to the trading stations.

but you dont need to have each of the wares on the list, if you put one ware in a station thats not even listed in the others, then it will still distribute them fine

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Thu, 28. Sep 06, 16:25

Cheers for the answer bud, I'm just about to set up another network and this will make things a lot easier (no need for hundreds of m4's/m5',s flying about).
The selling ship would be a great idea if it can sell all of the wares from a certain station.
Might be a good idea to stop any of the ships being able to enter Xenon space if possible. :wink:

CanadianBrit
Posts: 1406
Joined: Wed, 6. Nov 02, 20:31
x4

Post by CanadianBrit » Sun, 1. Oct 06, 05:21

Brilliant, but I eagerly await the ability to add stations to the network. Oh the joy this will bring to the SPPs!

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Sun, 1. Oct 06, 18:14

Hi Cycrow just started the trading network and have a bit of a problem :cry:

Right I bought 2 stations (Argon) and put one in Argon Prime and one in Light of Heart. Also a new Caimen SF (fully kitted with jump drive etc).

Created the network starting with the AP station and added the LoH, then added the Caimen which was parked at the AP EQ Dock (it jumped to the LoH station and docked).
Checked the Network status all looked fine. So I dumped some Space Fuel in the AP station. The Caimen sat around doing nothing :( .
So i stuck 1 unit of space fuel in the LoH station to see if that made a difference, nope Caimen stationary.
So I jumped him to AP Station to see if that would kick start him. Now he is sat in the AP station going between Idle and None and strangely his E-cells are increasing even though the Stations don't stock them.
I did reload and tried stocking Ecells then Space Fuel with much the same result.

Just wondered if you had any ideas, Cheers Bud :)

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sun, 1. Oct 06, 18:46

hmm, not sure whats going on there, check in the global script tasks, to c if, pluign.tdn.logic is running

ill have a look c if i can find any problems.
have you not been able to get it to work at all ?

u could also try removing the jumpdrive, c if that makes a difference, so at least ill know where to look

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Sun, 1. Oct 06, 20:50

No not had it working at all.

Looked for plugin.tdn.logic and it does run ocassionally but mostly the tdn.returnhome is spamming it.

Tried without the jump drive and the Caimen half filled with wares (as it should) went to the other station and stayed there with the wares in the cargobay. Didn't off load them.

So I'm guessing something to do with the jumpdrive and the Returnhome command maybe.

Cheers

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sun, 1. Oct 06, 22:49

hmm, strange, ill have to have a look at that.

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Mon, 2. Oct 06, 01:24

Don't know if this helps but if the ship is in the station that is set as the home base at that point it just keeps Looping the plugin.tdn.returnhome script. Either that or something keeps calling it.

If it is in the station that is not the homebase it gets stuck in plugin.tdn.shipdeliver script 'move to station' bit where ecells are checked and added.

I'm no scripter but I had a gander just to see if I could make sense of it and thats about as far as I got.

I'll have to do some homework :D

russbo
Posts: 862
Joined: Sat, 12. Nov 05, 21:53
x4

Post by russbo » Mon, 2. Oct 06, 03:36

I got to work a bit, using three trading stations, and a bunch of jumpdrive equipped Mako's. Just had the trading station nearest my factories buy stuff locally; the TDN assigned Mako's then just did their thing and tried to fill up the other trading stations. Only thing I did different, is I "added wares" to each of the other trading stations, not knowing that you don't have to do that, according to what Cycrow just said.

I'm just not having the best of luck here with the Mako's moving ALL of my wares around. I'll play with it a bit more.

Cycrow, if the transporters are jumpdrive equipped, will they automatically jump from one station to another, thus avoiding pirate sectors?

This is a great idea by the way.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Mon, 2. Oct 06, 12:16

they will jump between stations if there is enough energy cells, and they have enough room to store the energy cells after they pick up the wares.

the main problem with using makos is thier limited cargo space

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Wed, 4. Oct 06, 15:38

Cycrow I have been trying to work out whats going on which isn't easy when you know nothing about scripting :o . Anyway I checked the debug screen in the script editor and the ship seems to be stuck here :-
026 [THIS] -> set local variable: name='plugin.tdn.status' value='dock'
027
028 $homebase = [THIS] -> get homebase
029 if [THIS] -> get amount of ware Jumpdrive in cargo bay
030 @ = [THIS] -> call script 'lib.cycrow.jumptomax' : Station or sector=$homebase
031 else
032 [THIS] -> set destination to $homebase
033 [THIS] -> set command: COMMAND_DOCKAT
034 while not [THIS] -> is docked
035 @ = [THIS] -> call script '!move.movetostation' : station=$homebase
036 @ = wait 100 ms
037 end
Line 034 - 036 in an endless Loop.
Thats from plugin.tdn.returnhome. The code in !move.movetostation that the debug shows is:-
001 skip if $targetstation -> exists
002 return null
I haven't worked out why yet but thats not suprising as I have only read a couple of newbie guides.
I'm sure you will have more luck.
Cheers

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Wed, 4. Oct 06, 16:13

well, a simple check to c if the homebase exists should work, althou it should exist anyways

but it might be worth a try

Code: Select all

while not [THIS] -> is docked
... (move to station
....(wait)
skip if [THIS] -> exists
  break
ship if $homebase -> exists
  break
end
ill add it in the next version, but u can add it the to current version and c if it fixes it.

also, is the return home script actually running in the global scripts ?

Diesel309
Posts: 704
Joined: Sun, 11. Apr 04, 14:37
x3

Post by Diesel309 » Wed, 4. Oct 06, 17:46

Right gave it a try returnhome now reads:
034 while not [THIS] -> is docked
035 @ = [THIS] -> call script '!move.movetostation' : station=$homebase
036 @ = wait 100 ms
037 skip if [THIS] -> exists
038 break
039 skip if $homebase -> exists
040 break
041 end
But still getting the same result

The return home script is running multiple times in global scripts, at least a few pages full, this may have something to do with it.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Wed, 4. Oct 06, 18:05

yeah that sounds like a problem, they should be running on the ships themselves, not as globals, i will look into it

Post Reply

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