The Perfect Tower II

The Perfect Tower II

60 ratings
Factory Automation (Auto-Crafter)
By d0sboots
This set of scripts manages auto-crafting of everything in the factory.

It will prioritize using items already present in your inventory instead of crafting new ones, and it will always leave at least one dust of each tier. It can manage ore processing, dust up-tiering, and everything related.

It can also mass-craft groups of items for scanning in the Crafter.

If there isn't enough ore or rubber, the package will try to craft as much as it can and will simply halt progress when it runs out of material.

You can safely leave the factory and come back while the scripts are running, the craft will just continue where it left off.
4
2
2
3
   
Award
Favorite
Favorited
Unfavorite
How to install
Normally, I would post the import code(s) here directly. However, these scripts are quite complicated, and some of them are too large to fit within Steam's limits for a guide section.

Thus, you'll have to download it from my GitHub at https://github.com/d0sboots/PerfectTower/blob/main/README.md#factory-automation, which doesn't have length-limitations. A benefit is that all the imports are bundled in a single string. On GitHub if you hover on the right side of the import box, there's a clipboard icon that will directly copy it to your clipboard without worrying about how many times you clicked.

You will also need turbo exec v2 from https://github.com/d0sboots/TPT2_scripts/blob/main/common/turbo_exec/README.md. Without this package, the factory package won't do anything.

My GitHub also has more in-depth instructions, as well as other useful scripts.
How to Use
To use this, import and enable all the scripts in both this package and turbo exec v2. (You can right-click a package to quick-toggle-enable the whole package.) Then go to the factory and use WASD to select a quantity, tier, category, and item.

The available categories are Producers (PROD), Machines (MACH), Misc Crafted (CRFT), Produced Parts (PART), and Item Groups (GRUP).

Press "f" to craft when you're ready.

The list of all valid types can be found in the source code of factory_constants[github.com]
Basic Features
The package will prioritize using items already present in your inventory instead of crafting new ones, and it will always leave at least one dust of each tier.

It can manage ore processing, dust tiering, and everything related. If more dust of a certain tier is needed then there is in the inventory, the package will first use all ores of that tier, then use dust of the previous tier. (This package assumes you have the chemical lumps exotic skill; if you don't have it, it will likely get "stuck.")

You can upgrade machines with it, but the process is slightly involved: First, take the machine out of its slot. Then, start the upgrade with 'F'. If the machine is needed to do the work, you will then need to put it back into its slot, and take it out again at the very end, to finish the upgrade.

It uses a different up-tiering mechanism than my uptierer, and the two aren't aware of each other, but despite that they usually work fine together. If you completely run out of dust you may need to temporarily disable the uptierer in order to finish crafting, though.

If there isn't enough ore or rubber, the package will give an error message at startup. (New feature in v2.2.0!)

You can safely leave the factory and come back while the scripts are running, the craft will just continue where it left off.
Advanced Features
"Item groups" are added to allow quickly crafting large batches of items, for scanning in the Crafter. Some of them take a lot of space and/or time, especially the "all" group, so use with caution. (Maybe try out the narrower groups first.)

This uses the names of workers to store state about what item/tier is selected, so that it survives across restarts. By default, it will overwrite the first worker name, replacing it with "[factory]" followed by some numbers. If you want it to be in a different slot, put the "[factory]" tag there and get rid of it in the old location. It also won't ever overwrite a location that starts with a "[" (open-bracket).
Troubleshooting
This is what a working factory should look like:


Things in that screenshot to note, and how to fix if yours doesn't look like that:
  • The AI overlay itself. If you don't have that, you need to press F4.
  • The presence of TE2.1 register (or TE2.2:register) and TE2.1 (or TE2.2:turbo) in the active scripts list. If that isn't there, you didn't download turbo exec v2, or didn't activate it, or didn't re-toggle the AI after doing those things.
  • The presence of D0S.factory vX.Y.Z. If this isn't there, did you enable everything?
  • turbo.cycles is around 1100, turbo.state is "ACTIVE", and the status is "CRAFTING...". This indicates that it's processing. If this is not the case, either it completed right away, or never started. If turbo.cycles is 0, it definitely never started. If it never started, look for a variable labeled "error": This will tell you if something is seriously wrong. You might also have a status message telling you that you are missing resources.
  • If turbo.state is ACTIVE, but it's still not working, you are probably out of some resource. One thing that can happen is missing an intermediate tier of dust. Another is if you don't have the required skill "chemical lumps", it is likely to stall out on you without warning after trying to up-tier.
74 Comments
idea man May 28 @ 11:08am 
what is the minimum stuff i need to get this to start working?
i have nothing in my factory as i never touched it
Slizy Jan 10 @ 1:21pm 
Sorry to say but there is an input error when I use the auto-crafting code.
If you could help me understand the problem that would be much appreciated.
BrknSoul Dec 25, 2023 @ 5:36pm 
This stalls if I try to craft an item of which I don't yet have at least 1 of that tier's ore/dust.
There needs to be a cancel command
meltingpointsp Dec 15, 2023 @ 7:14am 
Anyone with Turbo Exec issues - make sure 'Migrate' is NOT checked when you import TE - D0S.factory seems to work fine with Migrate checked.
ON1VAS Nov 16, 2023 @ 1:33am 
i dont get how to actually use it? someone could link me a video?
CK Oct 7, 2023 @ 11:14am 
Is there a problem with making chips with this one? I am trying to make quantum chips which i assume is called tier 5 chip in the interface of the script. It says crafting.. like i have the necessary ingredients for it but i am not seeing any movement, any number of something i have increasing or decreasing. So i dont know if i should wait long enough for it to "craft" or is it just bugged?
_ItzEviLegenD_ Aug 15, 2023 @ 1:04pm 
@d0sboots idk what i'm doing wrong, but suddenly turbo exec stopped working, it says "error=turbo execis not working". i cant figure out what actually happened, can u help plz?
murkly gurgles Jul 16, 2023 @ 10:16am 
@SilentR You can select different segments of the line: "Make=0000001xT1 prod ...". When on that line (with WASD), move to select the "T1" part of that line (left/right), and adjust it (up/down).
SilentR Jul 16, 2023 @ 8:29am 
How do I change the tier and how much to craft?
James with the Games Jul 15, 2023 @ 9:27am 
Don't know what happened here, but the screenshot in the troubleshooting section no longer are present here. I tried downloading both of these and despite importing both your code and tubo.exec, it says that error=turbo exec is not working. Not sure how to check it considering the screenshot is now gone lol