New script: Maintain Factory Product Quantities...

The place to discuss scripting and game modifications for X²: The Threat.

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

Post Reply
User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

New script: Maintain Factory Product Quantities...

Post by Reven » Fri, 23. Jan 04, 14:29

I have a LaserTower factory, and one thing I noticed is that with the ability to only hold 2 units of products, it is quite inefficient.

If you want to have a factory like that for selling, then every time it hits 2 products, it stops production, which is wasted time. Then when a buyer comes along, you suddenly have nothing left to sell for hours.

If you want a factory like that to produce for your own needs, it requires a lot of micromanaging to transfer the goods.

So, I wrote a script to help and tied it into the Trade Command Software Mk. 1 system. All you need to do is assign a ship to the factory you want to maintain, and then tell it how many products you want the factory to keep in stock. For example, for my lasertower factory, since I sell them, I tell it to keep one in stock at all times. When the factory produces the second one, the ship automatically transfers it to itself. When someone buys one, the ship replaces it from what it has on hand (if any).

You can also use this for stockpiling shields or weapons that you use a lot of, like the 25MW shield for example.

The script should be able to handle most error conditions. If the ship isn't docked at its home base, it willl fly there first. If it can't hold the ware, or hasn't enough cargo space left, it will contact you.

You can download the script from my ftp site. To install simply unzip into your X2 folder. It should not overwrite any files - if you get a prompt to replace a file, don't. That means that you already have another mod that is conflicting. This is highly unlikely, but possible.

I will warn people that this should be considered a beta quality work. I have tested it (and use it), but I have not tested it exhaustively.

Let me know what you think.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

GnatB
Posts: 1225
Joined: Thu, 27. Feb 03, 20:44
x3

Post by GnatB » Fri, 23. Jan 04, 17:15

*grin* great minds think alike. If I ever get off work long enough to do some more scripting, (Finalling a project at work right now, lots of sitting around waiting for bugs to come in...), I'm planning on doing much the same thing... except sticking the "excess inventory" on a TL I have patrolling my weapons manufacturing sector, which is also a convenient supply depot for my fleet to resupply itself from, with one TP, (don't really need more) picking up/dropping off supplies.... but since it's gonna be dealing with all your factories in an entire sector, it's not gonna take input, but just try to keep 'em half full.... though it's gonna "buy/sell" the wares to the factories, not just pick the factories in positive cash flow, so they don't run out if they produce for a while w/o really selling.

Also want to modify my current "station accountant" script so instead of giving 'em money/taking money from stations to a specific amount of cash, it gives 'em enough money to fill up both resources and products. (assuming that the "total" for resources is about how many resources it takes to fill up on products, which is generally true, or close to it for most stations... so figure what percentage of current product vs. max product, multiply that my the max resource, then add difference between max resource and current resource, multiply that by the buy price of the resource, then add the same calculations for the other resources, and that should give the amount of cash the station needs to continue running perfectly with neither too much or too little, in a "worst case" scenario. it would only run out of cash when it's full of produce and full of resources.)

jojobeans
Posts: 153
Joined: Fri, 12. Dec 03, 15:23
x2

Post by jojobeans » Fri, 23. Jan 04, 17:41

GREAT SCRIPT! (Haven't tried it yet tho)

With modded ships that can carry 80 million pieces of cargo this script will make my life a lot easier. Just park a ship in there and go off flying without having to worry about production stopping.

Does this script work with resources? Meaning, if a ship has 10000 energy cells or whatever, will it transfer the ECs when the station runs low?

The bad thing about the stations is that they cannot hold much resources...so this script will come in handy IMHO.

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Sat, 24. Jan 04, 11:29

No, the command will only do it for a product. The best way to maintain resources is with Raskor414's excellent buy ware replacement script. This script can be used to make factory chains without having to have money change hands. The ships using this script will buffer resources - they obtain all the resources they can, and trickle them into the factory as the factory uses them up.

However, it's not really true that factories don't hold much resources. Factories actually hold a little over five and a half hours of resources (5 hours 33 minutes and 20 seconds to be exact). This is true for every factory except for mines that are built on an asteroid with a yield greater than 25, and for solar power plants in sectors with greater than 100% sunlight.

My script is more limited in scope, yes, but it was intended to be. I prefer a larger set of specific scripts, than fewer scripts that try and be more all-purpose. Just the way I work.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

Post Reply

Return to “X²: The Threat - Scripts and Modding”