This script trashes unwanted items that you pick up (from the mine floor 2). It runs automatically whenever you're in the Factory, and pauses itself when my factory automation is running so that it doesn't get screwed up.
Turbo exec v2 is not required, but it will speed up trashing greatly.
There are two ways to get this. The simple way is to grab this import code, but you will be stuck with the default configuration. (See below for what that means.)
tVfRcqM4EPyXfAEIsxWuah8gGGHWxgdxENLVPSApCcaSTcUGDFf371eyN4kxZLO7VfeKZnp6Wq2R+Odmz17W5WF/88dfN64WNQ+t6fA0rhM/yBnIBXue2bZtQw68F5ImjQuthqBJRaRXcGi1j9FUrd9zaBl0bRoZMjfUYFWWhjWDSXUHw5puQw0jU3NsLjEKNWoEpquyHGdPQZjTO7PjflBSySoGEq2fU2pMel3mWRucxnlvbT71mR/UxE8Kks4qZsQ59xNBASk4CmrW7Y6LYqE9+U5LQaxjkLTzLa+ZPHQZtJplMW0XXXx7iYGBpXBajkItQ1YVS9HS1RhOuMtSx8RpsBnDodBbUyPITxqN5UtdZyDRx7HjFqO4pJI31Ai1UXwkKjKK67UYeJvxtVxgFB858loOk3ZUH0lybMQ1226+LFazLvSPDZPWhqNQsLWpUYNXY3wYtAySBg2FXsXd77hQzzHISyofKpyGHUH6msKkPedHeliwyTI9HjAKdxkyxblvs2PQajkMBPWjMwf3AYTds9nDk1b5QywZtjwNdySdfYxhJBr/IYZePv5w3QIETT7EZ34gmBEKVpz1CFfYWLriliKvyKCoyL3ZEkRKKpM3j4zEdBn0mmEfgTo7Lz1uK+c2g96BIsXZu8XAW1P4UGXI7Dg65hwmm+t4iiyNGn3shX9sONKb61gGvIYqTq3ZchSsT5zSY4dTZ58hczvfkjpDkfqmfKAp7hx6RdZd9rZpnnxnj9NY7VHJZKhnaXRdv8Ao2JPVVR78MH5NoVVkrbkhyOwGeW/1YkG3oRj0BUXzUc4gVoqKDPoJauJ+UHMb6FgGJw88+WHBZGJcY3Ig2mGvoiLA0t5j+e0UcKG8kqFFRdJcKP+SNDSpXMy+z62cbqPpnR57i/WkXao5mQaaKy/ygKVRIOTlHLWf92oaLzGwDgx6rZrddG2WdBstCTjWWHr7uRQVvzO3JI16tdy3eSGeOPRaMpjfs/zPKC8oOHmh4vbpPrFddKwxeMPtrnEdFNYUWpW7DbWT5q1ZUhmLx6klp/B77vvagNedmiVpuEtBnHM47a3Zq12o/IJRo86GNpdccPuSY+Rk8c/cTXHJYXK4S0Mdv3I5DvOGmvTvtCstBr3YaLPEaVBymB9IGpe4Pe3NZz14GFh7CiZ9rHvt894j/bUHVWekb690pfJJvKMo0ZSvFNZnfbzuaR9r+tL34uk9Eb69L+7Ns1Yjb4Whruf9GPNMP25/6M0PW3QcBa+40as+6h1wmmtDjb7x8/voiUBPw1d6DXl55UiPl9rcnQ5Fr8bi/Ml2m6fm/9kPG22uvLHvc4pUfXNLkCmYFMVc8ppDqyTPvfPsn1gab5qrNQ0jUbGmp9l85l7OPTtgRrJ+1fg3zvRP+LjH0/mZuWOjzVy9Caj0lPdOM3BsLr57Q1QEJpMVwL/hmz7f5fOv+cixp7d9X9kf+MrMmRRaBnXBodpHUXH7l2uNndMVAUlF0kDNJPEIk4KnsWCGqHB/778l04d2Xsy+MHVXfO6pE+/pNq45mFQcKI0tYy5FRw1H0F5s5L//i3z9evP3v/8B
To customize the configuration involves a few more steps.
- Copy the workspace import code below. (It is not an import code you can use in the game.)
- Go to https://d0sboots.github.io/perfect-tower/
- Click the blue "Import" button in the upper-left, and paste the code into that.
- In the upper-right, it should now say that you are in Workspace: Auto-Trasher. On the lefthand side, click the script labeled "CLICK ME to change configuration".
- Follow the instructions there.
{"workspaces":{"Auto-Trasher":[["CLICK ME to change configuration",":import trasher_macros\n\n; Change the lines below to configure what is auto-trashed and what is kept\n; in the factory.\n;\n; Every line of the form \"auto_trash(\"item\", \"1234567890\")\" configures an\n; item for trashing. The item name (in the form the game wants) is the first\n; argument, and the list of tiers *to trash* is the second argument.\n; The tiers are single-character, with \"0\" being short for T10.\n;\n; (Don't worry about looking up item names - there will be a line for every\n; item in the game already.)\n;\n; If you want to stop trashing an item completely, you can change the tiers\n; to an empty string. Some lines are already like this by default.\n; DO NOT COMMENT OUT LINES TO STOP TRASHING. IT WILL NOT WORK.\n;\n; The initial configuration attempts to be a reasonable default:\n; It *keeps* T5 of all producers, gem/exo producers, T10 of all machines,\n; all tiers of chips, T8,9,10 of ingots, rubber, and all tiers of ore,\n; dust, and lumps. Everything else is trashed.\n; \n; Once you are happy with your changes, copy the export code in the box on\n; the right into the game.\n;\n; If something breaks and you need to re-import, make sure to delete this\n; workspace first (the red button in the upper-right) to get a clean slate.\n\n; Producers\n{auto_trash(\"producer.statueofcubos\", \"1234\")}\n{auto_trash(\"producer.workshop\", \"1234\")}\n{auto_trash(\"producer.constructionFirm\", \"1234\")}\n{auto_trash(\"producer.shipyard\", \"1234\")}\n{auto_trash(\"producer.exoticgems\", \"\")}\n{auto_trash(\"producer.gems\", \"\")}\n{auto_trash(\"producer.laboratory\", \"1234\")}\n{auto_trash(\"producer.museum\", \"1234\")}\n{auto_trash(\"producer.tradingpost\", \"1234\")}\n{auto_trash(\"producer.mine\", \"1234\")}\n{auto_trash(\"producer.arcade\", \"1234\")}\n{auto_trash(\"producer.headquarters\", \"1234\")}\n{auto_trash(\"producer.factory\", \"1234\")}\n{auto_trash(\"producer.town\", \"1234\")}\n{auto_trash(\"producer.powerplant\", \"1234\")}\n\n; Boosters\n{auto_trash(\"booster.resource.drops\", \"\")}\n{auto_trash(\"booster.production.regular\", \"\")}\n{auto_trash(\"booster.acceleration\", \"\")}\n\n; Machines\n{auto_trash(\"machine.assembler\", \"123456789\")}\n{auto_trash(\"machine.transportbelt\", \"123456789\")}\n{auto_trash(\"machine.boiler\", \"123456789\")}\n{auto_trash(\"machine.crusher\", \"123456789\")}\n{auto_trash(\"machine.cutter\", \"123456789\")}\n{auto_trash(\"machine.mixer\", \"123456789\")}\n{auto_trash(\"machine.oven\", \"123456789\")}\n{auto_trash(\"machine.presser\", \"123456789\")}\n{auto_trash(\"machine.refinery\", \"123456789\")}\n{auto_trash(\"machine.shaper\", \"123456789\")}\n\n; Various parts\n{auto_trash(\"block\", \"1234567890\")}\n{auto_trash(\"chip\", \"\")}\n{auto_trash(\"hammer\", \"1\")}\n{auto_trash(\"cable.insulated\", \"1234567890\")}\n{auto_trash(\"motor\", \"1234567890\")}\n{auto_trash(\"pump\", \"1234567890\")}\n{auto_trash(\"sapling.rubber\", \"1\")}\n{auto_trash(\"sapling.void\", \"1\")}\n{auto_trash(\"plate.stack\", \"1234567890\")}\n\n{auto_trash(\"plate.circuit\", \"1234567890\")}\n{auto_trash(\"cable\", \"1234567890\")}\n{auto_trash(\"circuit\", \"1234567890\")}\n{auto_trash(\"block.dense\", \"1234567890\")}\n{auto_trash(\"plate.dense\", \"1234567890\")}\n{auto_trash(\"pipe\", \"1234567890\")}\n{auto_trash(\"plate\", \"1234567890\")}\n{auto_trash(\"ring\", \"1234567890\")}\n{auto_trash(\"rod\", \"1234567890\")}\n{auto_trash(\"plate.rubber\", \"1\")}\n{auto_trash(\"plate.rainbow\", \"\")}\n{auto_trash(\"screw\", \"1234567890\")}\n{auto_trash(\"wire\", \"1234567890\")}\n\n; Pumpkin stuff\n{auto_trash(\"pumpkin\", \"\")}\n{auto_trash(\"pumpkin.plate\", \"\")}\n{auto_trash(\"pumpkin.carved\", \"\")}\n{auto_trash(\"pumpkin.anti\", \"\")}\n{auto_trash(\"pumpkin.stack\", \"\")}\n{auto_trash(\"pumpkin.producer\", \"\")}\n\n; Ingredients\n{auto_trash(\"dust\", \"\")}\n{auto_trash(\"dust.rainbow\", \"\")}\n{auto_trash(\"ore\", \"\")}\n{auto_trash(\"lump\", \"\")}\n{auto_trash(\"rubber\", \"\")}\n{auto_trash(\"ingot\", \"1234567\")}\n{auto_trash(\"ingot.rainbow\", \"\")}\n{auto_trash(\"essence.void\", \"\")}\n\n; ===========================================================================\n; CONFIGURATION ENDS / AI SCRIPT CODE BEGINS\n; ===========================================================================\n\n:name D0S.AutoTrasher\n\nwakeup()\nopen.factory()\n\nisopen(\"factory\")\n\n:global int factory_target\n\n:local string trash_data\n:local string item\n:local int i\n:local int colon\n\n; Save the computed data in a local variable, since we have to reference it\n; multiple times. The format is \"item1:tiers|item2:tiers|\", etc.\ntrash_data = {trash_data}\n\nmain_loop:\n; We support turbo-exec for speed and compatibilty with the factory, but\n; it's not required. Using turbo actually *reduces* lag when we're running\n; alongside the factory - instead of running all our instructions, we'll\n; spend most of our time in 'executesync(\"turbo stop\")', which is much faster\n; to run.\nexecutesync(\"TE2.2:start\")\n\n; Abort execution if the factory is active. This ensures that we cause neither\n; problems nor lag for the factory, at the expense of an additional frame of\n; slowdown if we are running without turbo.\ngotoif(end_frame, factory_target != 0)\n\n; Here we search for the end of the item name and save it an a temporary\n; variable, as well as moving the position to the tiers section. We could make\n; this one line shorter, but we have lines to burn and this makes the export\n; code smaller.\ncolon = index(trash_data, \":\", i)\nitem = sub(trash_data, i, colon - i)\ni = colon + 1\n\ntier_loop:\n; The inner loop. Each iteration trashes one tier of an item.\n; We turn the current position \"i\" into a tier by using a tiny lookup table.\n; The first character \"-\" is just a filler, to offset by 1 - it's much cheaper\n; than adding.\n; We trash \"infinity\" items rather than counting them.\n; It important to keep this loop tight in case we don't have turbo - it takes\n; 3 frames per tier, plus 8 frames of setup per item.\ntrash(item, index(\"-1234567890\", sub(trash_data, i, 1), 0), 1. / 0.)\ni += 1\ngotoif(tier_loop, contains(\" 1234567890\", sub(trash_data, i, 1)))\n\n; We have to adjust \"i\" past the delimiter character, and this is also an\n; opportunity to reset if we've reached the end of the list.\ni = if(index(trash_data, \":\", i) < 0, 0, i + 1)\n\nend_frame:\nexecutesync(\"TE2.2:stop\")\n\n; This is safe to re-execute if we're still in turbo.\ngotoif(main_loop, isopen(\"factory\"))\n"],["trasher_macros","; Macro support for the auto-trasher. This is basically just the\n; auto_trash macro.\n\n; The work here is surprisingly simple: We're just concatenating \"item\" and \"tiers\"\n; together with delimiters.\n;\n; One wrinkle is that we're storing them as \":const\" variables that are declared,\n; instead of putting them in a Lua array. The reason for this is so that if one\n; of the lines is commented out, the declaration will be commented out, leading\n; to a compile error when we concat all the declarations.\n;\n; This is sadly the best we can do - it's not as good as having it work the way\n; the user intends (which I believe is impossible currently), but it's *much*\n; better than silently trashing the items anyway.\n\n{lua(trash_count = 0)}\n\n#auto_trash(item, tiers) {lua(\\\n trash_count = trash_count + 1\\\n local item_data = ({tiers} == \"\") and \"\" or ({item} .. \":\" .. {tiers} .. \"|\")\\\n return (\":const string DO_NOT_COMMENT_OUT_auto_trash_\" .. trash_count ..\\\n ' \"' .. item_data .. '\"')\\\n)}\n\n#trash_data {lua(\\\n local acc = {}\\\n for i = 1, trash_count do\\\n acc[i] = \"DO_NOT_COMMENT_OUT_auto_trash_\" .. i\\\n end\\\n return table.concat(acc, \" . \")\\\n)}\n"]]}}
If you need to re-import, make sure to delete the workspace first (red button in the upper-right) to start fresh.
The default configuration is: It keeps T5 of all producers, gem/exo producers, T10 of all machines, all tiers of chips, T8,9,10 of ingots, rubber, and all tiers of ore, dust, lumps, essence, pumpkin stuff, boosters and rainbow items. Everything else is trashed.