Page 1 of 15

[Bonus Plugin] Station Manager

Posted: Thu, 24. Aug 06, 20:47
by moggy2
Name: Station Manager
Version: 1.16b
Date: 15.07.2006
Scripters: Burianek and AalaarDB
  • Overview:

    Station Manager is a fully automated software system that manages and coordinates traders assigned to a station or complex. It will decide which wares need to be bought and sold, and where the best locations are to buy and sell them. It's very flexible and allows you to assign as many or as few traders as you like to take care of a factory.

    Traders assigned to the same factory will coordinate with other automated traders and will not all try to buy the same ware at the same time. They will also try not to visit the same stations to trade the same ware. Station Manager allows you to customize the traders belonging to a station and set up individual parameters for each ship for which wares should be traded, and how far of a jumprange to look within. So, for example, it is very easy to set up a Solar Power Plant to have two customized ships supplying it: a small, fast ship that looks for crystals to buy within a large jumprange, and a huge energy tanker that sells energy cells to the stations immediately surrounding the Solar Power Plant.

    In order for your traders to be able to see the ware prices within a sector, you must have a satellite, ship, or station in the sector to be scanned (this is shown by a green border around the sector in the galaxy map). Your ships will not visit sectors where they cannot see the ware prices. You can use this to your advantage. If you don't want traders to visit sectors because you think they might not be safe, do not put any satellites, ships, or stations in those sectors, and your traders will not look for stations to trade at within them.

    Starting Station Manager:

    Select the 'Station Manager: Automate' command from the station command console. The first time this is activated on a station, the station account (or player account) will be debited 25,000 credits to install the software. This is a one time fee per station. If you stop the Station Manager command on your station and restart it, you will not be recharged. After Station Manager is running on a station the commands 'Station Manager: Add Ship' and 'Station Manager: Remove Ship' will appear in the station command console.

    Stopping Station Manager:

    Go to the station's command console and select the command slot Station Manager is running on. Select none to stop the station from running Station Manager.

    'Station Manager: Add Ship' station command:

    To add a ship individually, select the 'Station Manager: Add Ship' command and then select one of your ships. Note that your ship must not currently be docked to be able to find it to select it. Once your ship has been selected, it will be added to the station's list of traders (set homebase) and the ship will be automated by the Station Manager software. The following ship types can be assigned to trade for a station: M3, M4, M5, M6, TS, TP.

    An alternative action for this command is to run it and select the station itself instead of a ship. This will do 1 of 2 things. If a station has any number of owned ships that are not automated traders, there will be the option to add all owned ships as traders. If a station has any number of automated traders there will be the option to list all of the traders belonging to the station and their status. If both of these are applicable then you will be presented a choice between these 2 options, or if only 1 is applicable then that option will execute without the choice.

    When a trader is automated by the station, 4 new commands may be added to the command console of your automated traders. In the Additional Ship Commands section of the command console will be the commands 'Station Manager: Display Status', 'Station Manager: Prohibit Ware' and 'Station Manager: Set Jumprange'. In the Trade Menu section of the command console may be 'Station Manager: Continue' under certain circumstances.

    'Station Manager: Remove Ship' station command:

    To stop a ship from being an automated trader, select the 'Station Manager: Remove Ship' command from the station command console, then select a ship that already belongs to the station. The ship will be removed from the station's list of traders (remove homebase) and will stop trading for the station and will begin to idle in space.

    An alternative action for this command is to run it and select the station itself instead of a ship. This will stop all the station's ships from being automated traders.

    'Station Manager: Continue' ship command:

    It is possible to manually interrupt one of your traders by simply issuing it a new command. This can be useful to dock the trader somewhere safe if it is in danger, or to make a lucrative one time transaction. A short period of time after a trader has been manually taken control of, the station will place the command 'Station Manager: Continue' in the Trade Menu of the ship's command console. Select this to order the ship to begin trading for the station again. If your trader has been automatically sent to a repair dock to get fixed, you can also restart the trader by using this command after you fix it. Stopped traders will not restart trading until this command is issued.

    'Station Manager: Display Status' ship command:

    Select this command to display the status of this ship. The information received is Ship Name and ID, Homebase or Location, Current Status, Traded Wares, and Jumprange.

    'Station Manager: Prohibit Ware' ship command:

    Select this command and then select one of the wares to prevent your trader from trading it. To reallow your trader to trade a prohibited ware, simply select the command again and choose a prohibited ware. Your trader will now be allowed to trade it again. To see which wares a ship can trade, use the 'Station Manager: Display Status' command. Traders are set up to trade all of the wares of a station by default.

    'Station Manager: Set Jumprange' ship command:

    Select this command and then enter a jumprange. To use the station's standard jumprange parameter, enter a negative number for the jumprange. To see the jumprange defined for a trader, use the 'Station Manager: Display Status' command. Traders are set up to use the station's standard jumprange by default.

    Detailed Trader Logic Description:

    - Traders will only buy resources if your station is less than 90% full, and will only sell products if your station is more than 10% full.
    - Your ships will look at their homebase and make a decision as to what the most critical ware to trade is. They will look at what other ships belonging to your homebase are attempting to do to help them make the best decision. So, if your station desperately needs energy, but you already have another freighter enroute to buy more than enough to supply the station with energy, your trader might look for a different ware to buy or sell.
    - After a trader has decided which ware to trade for the station, it will look for the best station to go to. It will search the stations of all sectors within jumprange that have a player asset in them (have a green border on the galaxy map so the player can see ware prices). The trader will rank order the stations by best price, and then by shortest jumprange. It will then visit the best station that no other trader is visiting for this station for this ware. Traders can visit the same station if it is to trade different wares, i.e. two traders from an spp might visit the same crystal fab if one was going to sell energy, and the other to buy crystals.
    - Once a trader has a ware and station to trade, it will start travelling towards that station. Every sector, the trader will make a limited search to see if there is a better station to trade at. A limited search means that only stations that are as close as, or closer than the current target station will be checked. This is to prevent a trader from flying one sector east and then saying, "oh wait, the best station is to the west", flying one sector west and then saying, "oh wait ..." and never landing anywhere. Traders that set out from a station will always continue to close to a target with every sector travelled unless something happens such that there are no stations within the jumprange to the current target that trade the ware for the price limits set at the homebase. When this happens, the trader will abandon the current trade run and will start completely over, looking for the best ware to trade for the station. (if it picks the same ware, it will expand its search to include all sectors within the jumprange of the homebase)
    - If a trader ever picks a ware and finds that it cannot find any stations at which to trade that ware within the price limits set at the homebase, it will give up on that ware and pick the next best ware to trade for the homebase.
    - If a trader finds that it cannot trade any wares for its homebase, it will return to its homebase and sit there until it is possible to trade something.
    - Traders that have been damaged to have less than 80% hull value will not continue trading for your factory. Instead, they will automatically fly to the nearest safe repair dock and contact you for help. Safe means that they will not cross any sectors owned by races defined as enemies in the ship's friend/foe settings.
    - Traders can either buy or sell intermediate products of complexes, but they cannot do both at the same time. If the station's intermediate products parameter is set to buy and sell then they will only be bought.
    - Traders cannot coordinate with other station's traders or with traders from the same station that are not being automated. For best results, allow the station to automate a trader and restrict it to one ware instead of issuing other trade commands.

    Explanation of Pathfinding Algorithm:

    The Station Manager uses AStar to find paths to the destination, rather than the normal paths. These paths are, in general, safer. You can change the way AStar makes paths relatively easily, to customize it to your playing style.
    AStar assigns a cost to each path it could take to get to the destination. It then chooses the path with the lowest cost as the optimum route. The easiest way to think of cost is: safety_weighting * distance, with higher safety weighting meaning more dangerous.

    As an extremely simplified example, assume there are two paths to get to a destination:
    Path 1: 300km travelled through enemy sectors
    Path 2: 400km travelled through neutral sectors
    Foe weighting: 1.55 (this is the default weight used for Foe sectors in Station Manager)
    Path 1 cost: 300km * 1.55 = 465
    Path 2 cost: 400km * 1 = 400
    In this example, AStar would pick the safer route because it costs less, even though it is a bit longer. Notice that if Path 2 were much longer (greater than 465km) AStar would actually prefer to go through the enemy sectors.

    To change the saftey weightings to get AStar to prefer different routes on your computer, open up your script editor, and open the file Please do not edit any other files. You may edit the 4 numbers at the top, but it is recommended you only edit the FOE number. You may also edit the center of the script in between where it says to edit. This spot is for those who want to have different costs for different races of the same type. For example, Xenons might be more dangerous than Pirates although they are both FOE.
    For instance, if you want the trader to stay safer by visiting enemy sectors less often, increase the FOE number. If you want your traders to prefer faster routes with increased risk, decrease the FOE number slightly. You can even make traders prefer visiting 'Allied' sectors more often by decreasing the Friend number.

    If you are interested, please see for a further explanation of AStar. Please note: the AStar here and there are different, the Station Manager version will not overwrite the commands - it is only for your station traders.

Posted: Fri, 25. Aug 06, 02:12
by Hieronymos
Question: does using Xai Corp's NOS (Navigation Override System) to keep my automated traders safe(r) conflict in any way with A-Star or Station Manager?

Posted: Fri, 25. Aug 06, 09:43
by danprivatus
This is such a lovely script! I've been using it for a long time and I can't think of any script/mod I have that is more valuable than this one. I'm so glad it made it into the bonus pack. Congratulations, Burianek and AalaarDB! You guys worked so hard for it and it paid off.

Now then ... I'd like to install the bonus pack, but I'm already running this script. Should I remove the script before I install the bonus pack? Should I land every freighter or at least give it "none" orders before I install the bonus pack and load a saved game?

Thanks for any advice!

Posted: Fri, 25. Aug 06, 16:39
by ITM
This pack is a great idea!
I've never used such a script before, and I get a bit disappointed when installing it :S
- All my traders are trying to sell my products at the same station, what the hell, they're not supposed to do that ?!
- If I restrict a trader to an intermediate product, such as energy cells, it won't do anything (the complex is full of these though...)

Intermediate products are not supposed to be sold?
Why do they all sell at the same place, that acts as ridiculous as the regular "sell ware" command.
Thanks for help!

Posted: Fri, 25. Aug 06, 18:36
by Jakesnake5
I mentioned this in the L3 thread, but nobody paid attention (AalaarDB).

I have ships also BUYING at the same stations, which is useless as the buy price is invalidated by the first one.

The last Non-Bonus version I use (1.11) doesn't do this, it behaves like the readme states.

Posted: Mon, 28. Aug 06, 19:09
by Jakesnake5
BTW: If your using the pre-Bonus Pack Station Manager, you need to shut it down totally before switching:

Space ships attached to a SM station, then use the stations Additional Commands to remove it from the stations control.
Remove SM command from station.
Wait 2 mins in SETA to make sure script is terminated.
Save game, then uninstall pre-Bonus version (important)
Install Bonus version, load game, and restart SM like normal, assign ships, and away you go.

Bonus pack 1.00 version has a small bug, that will prevent more than one ship visiting stations. Unfortunately, though you can fix the script in question yourself, it requires activating the SE to do so. (It was caused by wrong conditional <== instead of !=> being used).

Next BP release may have fix.

AalaarDB had posted a fix in the L3 forum, but pulled it when the BP came out. I do know, from comparing the files (broke and fix) what was wrong.

Posted: Mon, 28. Aug 06, 23:06
by Gunslinger_000
Well, I think this is very buggy. I am testing it now on 2 stations, and both are screaming for resources. In both cases it is meatballs. In one station, in Antigone Memorial, my Crystal Fab needs meatballs. I have set the buying price to 75. There are 870 meatballs at 72 on the Trading Station, but my freighter is sitting in the Crystal Fab. When I ask for a report, it says it is waiting for a deal.

That's no good!


Posted: Mon, 28. Aug 06, 23:23
by moggy2
this has been updated in the new version of the bonus pack just released.

Please install the new version and see if it solves the problems.

Posted: Tue, 29. Aug 06, 08:27
by Jakesnake5
Uh, known problem with getting your traders to buy things from Trading Stations.

Set the buy price to 72 and watch them go. Not sure why, but it works.

Posted: Tue, 29. Aug 06, 10:07
by apogee
Just a quick question...

I installed the bonus pack, but only used the station manager. i converted 3 SPPs to use this each with 2 sellers, and also a new SQUASH complex that was fully dependant on station manager for re-supply.

However after about 3 hours of use x3 locked up completely with the cpu at 100%, if i re-loaded after then it locked up at exactly the same point, so there was obviously some event occuring that got it in a twist.


1) This has never happened before, ever!
2) The bonus pack was installed on a vanilla version of 1.4.03, so there are no other scripts running other than the standard game.

I did notice that the spp sellers were attempting to sell to the same target, and i know this has been addressed in the update.

But my question is, will installing the update fix the lock up i encountered? i really do not want to spend another 3-4 hours progressing only to find i have to regress to a standard install, like i had to do on saturday?

Posted: Tue, 29. Aug 06, 17:58
by Jakesnake5
From the temp fix AalaarDB put up in th L3 thread, not only did he correct the conditional that buggered the ships 'working together' to not visit the same station, but another script was altered.

This one had a 'wait' put in (only change), so if its the unfixed version of that script thats causing the lock, then the update SHOULD fix it. Now if updating does NOT fix it, it could be another script that got 'infinity looped'. But you say your only running SM, so hopefully updating should fix it.

There was no explanation on why that wait was added. But scripts not having waits can sometimes LOOP and nothing else will run.

For the first fix, you need to set the traders to 'none' command. Then wait till their trade menu comes up with the 'Resume' option and use it. This will update the script their running immediately.

Posted: Wed, 30. Aug 06, 07:19
by Donsja
i seem to have a problem with this. After some time, they will be on the command "none" and have to use the continue key, every hour or so :(

or am i doing something wrong?

Posted: Wed, 30. Aug 06, 11:36
by jlehtone
Stupid question. EQdocks and Trade Stations. Do they have resources, products, or both?

IIRC, the X2 BPH/ATC could only buy to them, and never sell. That was by design.

So if I place my Trade Dock next to NPC one, both stock ware X, and both have "average" price, what will the Manager do? (Ignore the non-profit deal, I guess.)

Posted: Wed, 30. Aug 06, 19:05
by Jakesnake5

That is caused when so many 'customers' want to dock it kicks your ships out. They resort to 'Idle' until they can dock, then go to 'None'. You just need to run the Trade command to Resume.

This 'kick from dock' is most noticble when you get a station selling something everybody wants. They don't always undock immediately, which can be an issue.

Stations/Complexes reserver 1 arm for YOU, so it routinely only has 4/9 (unless your have the Extended Complex Hub Mod, then its 19) for npc ships to use, including yours. Quite often, you get those idiot 'civis' docking and wasting space.

I use the No Civi mod, and Armagedons Extended Complex Hub. The first removes the taxi's and non-specific civis, the second not only doubles the docking capacity of complexes, but gives fighters a place to dock that doesn't use the arms (good for Spacefuel/Spaceweed complexes).

AalaarDB didn't really make SM to support Trade Stations or EQ docks. He said that'd make the script more like Sector Trader/Universe Traders of the Trading Software MK3. You'll probably need another script to do what you want.

Posted: Wed, 30. Aug 06, 19:14
by jlehtone
:? I thought that I already edited my previous message to say that I did found the answer in the original script thread.

Yes, it makes sense. Supply manager, not Trading Station Manager. :wink:

Already before the Bonuspack, my aim was to make multi-sector trader out of Trading Station and freighters. Works fine with Trade Mk1. It seems that CA and CLS Mk1 can add control (ie power) to the trading networks setup.

Did the Readme say at any point that SM is not for Docks? Sure, it probably was implied by other text.