Welcome, Commander!
This guide explains how to use the Shadow Base Management script (v1.22+) in everyday play. Use the sidebar or ←/→ arrow keys to browse.
Quick‑Start
- Upload the latest script version to a Programmable Block (PB).
- Name two Text Panels exactly:
BaseManagement LCD
&Keyboard Input LCD
. - Compile/Run the PB once — default settings are created in its Custom Data.
- Use the BaseManagement LCD and physical buttons (or toolbar actions) bound to the PB with arguments up, down, confirm, back to navigate the menu.
- Explore the menu options to enable and configure features.
Core Purpose
This script automates common base tasks like ore refining, inventory sorting, component crafting, and door management, freeing you up for more important activities. It aims to be efficient and configurable through an in-game LCD menu.
What Does the Script Do?
Main Features
- Refinery Manager: Intelligently feeds refineries based on a customizable ore priority list, even ejecting lower-priority ore if something more important is available.
- Container Sorter: Automatically files items into designated containers based on simple tags (e.g.,
[Ing]
,[Com]
) in their name or Custom Data. - Keeper Crates: Designate specific containers to maintain a minimum stock level of essential items (defined in Custom Data using
[KEEP_STOCK]
). The sorter prioritizes filling these. - Auto Crafting: Monitors inventory levels (including keeper crate demand) and automatically queues needed components at a designated assembler (tagged
[AC]
by default). - Smart Auto Doors: Closes doors automatically after a configurable delay. Supports ignoring specific doors or groups via a menu-managed list.
- Remote Grid Sorting: Pulls items from connected remote grids into your local tagged containers, configurable per-grid and per-category.
- LCD Menu System: Configure all features directly in-game using two LCD panels and simple navigation commands.
- Operation Log: Tracks significant actions and warnings for easier troubleshooting.
Menu Navigation
The primary way to interact is via the BaseManagement LCD. You need controls (buttons, cockpit toolbar) mapped to the Programmable Block running the script, using these arguments:
up
: Move selection up.down
: Move selection down.confirm
: Select option, enter submenu, grab/place item (in editors).back
: Go back to previous menu, cancel input/grab.
The Keyboard Input LCD is used only when the menu prompts for text input (e.g., setting delays, quantities, names).
Initial Setup & Configuration
Required Blocks
- 1× Programmable Block (PB): This runs the script.
- 1× Text Panel / LCD: Must be named exactly
BaseManagement LCD
. This displays the main menu. - 1× Text Panel / LCD: Must be named exactly
Keyboard Input LCD
. Used for text entry when needed. - **(Optional but Recommended) Buttons / Cockpit Toolbar:** For easy menu navigation using arguments
up
,down
,confirm
,back
.
First Run & Basic Settings
- Paste the script code into the PB editor, check code, and click OK.
- The script should compile. If errors occur, check the PB's terminal screen details tab.
- The menu should appear on the
BaseManagement LCD
. - Navigate the menu using your configured buttons/toolbar actions.
- Go through each main menu item (Refinery, Container Sort, etc.) and use the "Toggle On/Off" option to enable the features you want.
- Adjust the Operation Interval (default 10 ticks ≈ 6 times/second) based on your base size and performance needs. Lower values are more responsive but use more CPU.
Container Tagging (for Sorter)
To tell the sorter where to put items, add tags to the Name or Custom Data of your destination Cargo Containers:
[Ing]
: For Ingots[Com]
: For Components[Ore]
: For Ores[Tool]
: For Hand Tools (Welders, Grinders, Drills)[Bottle]
: For Oxygen and Hydrogen Bottles[Ammo]
: (Example) For Ammo Magazines (if you add this category)[Unsorted]
: (Optional) A single container to catch items the sorter doesn't know where to put, or items cleaned from other containers.
Example Name: Cargo - Components [Com]
Example Custom Data:
This container holds components.
[Com]
The script checks both fields, case-insensitively.
Keeper Crates (Custom Data Setup)
Designate a container to automatically maintain stock levels. Add this section to its Custom Data:
[KEEP_STOCK]
# Item SubtypeId = Amount to Keep
SteelPlate = 1000
Construction = 500
Computer = 200
Motor = 150
LargeTube = 100
SmallTube = 300
InteriorPlate = 800
PowerCell = 50
Detector = 20
RadioCommunication = 30
HydrogenBottle = 10
OxygenBottle = 10
# You can use short names (like Motor) or full names (MotorComponent)
# You can also keep non-components:
Iron = 5000
Ice = 10000
- Use the item's SubtypeId (e.g., `SteelPlate`, `Computer`, `Iron`, `Ice`). Short component names (like `Motor`) are usually accepted.
- The script will try to pull missing items from other containers to meet these targets.
- Auto-Crafting will consider this demand when queueing components.
No Sort Tag
To completely exclude a container from all sorting operations (both as a source and destination, including keeper logic), add this tag to its Name or Custom Data:
[NO_SORT]
Useful for personal lockers, specific project bins, or connector cargo.
Auto-Crafting Setup
- Tag exactly one functional Assembler with
[AC]
in its name (or change the tag via the menu). - Use the "Auto Crafting" -> "Edit Component List..." menu to set desired quantities for components.
- Enable the "Auto Crafting" module.
- The script will queue items at the tagged assembler if the total available (in local tagged containers, assembler outputs, *and* keeper crates) plus currently queued items is less than your desired amount + keeper demand.
Physical Button Setup (Recap)
Bind PB "Run" actions to buttons/toolbar slots with these arguments:
up
down
confirm
back
Refinery Management
This module ensures your refineries prioritize processing the ores you deem most important.
How it Works
- Priority List: You define an ordered list of ore SubtypeIds (e.g., Platinum, Gold, Iron). Ores higher on the list get processed first.
- Feeding Idle Refineries: When a refinery finishes its current task and its input is empty, the script finds the highest-priority ore available in your tagged
[Ore]
containers (or any container if none are tagged) and moves one stack into the refinery. - Priority Enforcement (Ejection): If a refinery is currently processing a lower-priority ore (e.g., Stone) but a higher-priority ore (e.g., Platinum) becomes available in storage, the script will *eject* the Stone back into a cargo container and immediately feed the Platinum. This ensures refineries quickly switch to more valuable tasks.
- Single Stack Transfer: Only one stack is moved at a time per refinery check to prevent flooding small refinery inputs and allow other refineries a chance to grab ore.
Configuration
- Toggle On/Off: Enables or disables the entire refinery management feature.
- Edit Ore Priority List...: Opens the interactive list editor:
- Use up/down to select an ore.
- Press confirm to "grab" the selected ore.
- Use up/down again to move the grabbed ore.
- Press confirm again to place the ore and save the new order.
- Press back while grabbing to cancel the move and restore the previous order.
- Press back while *not* grabbing to exit the editor (changes are saved automatically when placing).
- The list defaults to common ores if empty. You currently need to edit the script's `DefaultOrePriority` list or manually edit the saved `priority=` line in Custom Data to *add* new ore types not already present.
Container Sorting
The sorter automatically organizes items on your local grid into designated containers, including managing special "Keeper Crates".
Core Logic (Order of Operations)
- Discover Destinations: Identifies containers tagged
[Ing]
,[Com]
,[Ore]
,[Tool]
,[Bottle]
,[Unsorted]
, and those with[KEEP_STOCK]
or[NO_SORT]
in their Name/CustomData. - Top Up Keeper Crates: Prioritizes moving items from general storage (non-keeper, non-nosort containers, assembler outputs) into Keeper Crates until their target amounts are met.
- Sort General Inventory: Moves items from source inventories (non-keeper, non-nosort containers, assembler outputs) into their correctly tagged destination containers.
- Clean Destinations (Optional): If enabled, scans tagged destination containers and moves any items that don't belong (based on tag) to their correct destination or the
[Unsorted]
container.
Each step respects the global "Moves/Tick" limit to manage performance.
Configuration (Sorter Settings Menu)
- Toggle Local Sort: Enables/disables the entire local sorting process (Steps 2, 3, 4 above). This is the main switch for the sorter.
- Moves/Tick [Edit]: Sets the maximum number of item *stack* transfers the sorter (including keeper and cleaner actions) will perform in a single execution cycle. Higher values sort faster but may impact performance on very large bases. Default: 20. Minimum: 1.
- Remote Grid Settings...: Enters the menu for configuring sorting from connected grids (see Remote Grid Sorting section).
- Clean Destinations: [ON]/[OFF]: Toggles whether the sorter should perform Step 4 (cleaning wrongly sorted items from tagged containers). Default: ON.
Tagging Recap
- Use
[Ing]
,[Com]
,[Ore]
,[Tool]
,[Bottle]
(case-insensitive) in Name or Custom Data for destination containers. - Use
[KEEP_STOCK]
section in Custom Data for keeper crates (see Setup). - Use
[NO_SORT]
tag in Name or Custom Data to exclude a container entirely. - Use
[Unsorted]
tag for a fallback container during cleaning (optional).
Handling Full Destinations
If all destination containers for a specific category (e.g., all [Com]
containers) become full, the script will stop trying to move items of that category for a short cooldown period (15 seconds) to avoid unnecessary conveyor traffic. It will resume trying once the cooldown expires.
Auto Doors
This module automatically closes doors that have been left open.
How it Works
- The script monitors all doors accessible via the terminal system.
- When a door transitions to the "Open" state, a timer starts for that door.
- If the door remains "Open" for longer than the configured delay, the script commands it to close.
- Doors that are already "Closed" or "Closing" are ignored.
- Doors listed in the "Ignore List" are completely skipped by this module.
Configuration
- Toggle On/Off: Enables or disables the auto-close feature.
- Close Delay [Edit]: Sets the number of seconds a door must remain fully open before the script attempts to close it. Allows time for players/vehicles to pass through.
- Manage Ignore List...: Opens a menu to add or remove specific blocks or entire block groups from being auto-closed.
- Select "Add Ignore Entry..."
- Choose "Block Name" or "Group Name".
- Use the Keyboard LCD to type the exact, case-sensitive name of the block or group.
- Select an existing entry and press confirm to remove it.
Tip: Use the ignore list for hangar doors, airlocks managed by other scripts/timers, or any door you explicitly want to remain open until manually closed.
Auto Crafting
Automatically maintains a desired stock level of components using a designated assembler.
How it Works
- Designated Assembler: You must tag exactly one assembler with
[AC]
(or your configured tag) in its name. This is the *only* assembler the script will queue items in. - Desired Quantities: You set target amounts for components via the "Edit Component List..." menu.
- Stock Check: The script calculates the total available amount of each component by summing:
- Items in all local containers tagged for that component (e.g.,
[Com]
). - Items in the output inventories of *all* local assemblers.
- Items requested by active Keeper Crates (
[KEEP_STOCK]
demand). - Items already queued for production in *all* relevant (non-coop, capable) local assemblers.
- Items in all local containers tagged for that component (e.g.,
- Queueing Logic: If the `Total Available` is less than the `Desired Quantity + Keeper Demand`, the script calculates the exact `Net Need` and queues that amount in the designated
[AC]
assembler. - Cooldown: To prevent spamming the queue due to game state delays, the script waits 5 seconds after queueing a specific component before it will consider queueing *that same component type* again.
Configuration
- Toggle On/Off: Enables or disables the auto-crafting feature.
- Clear All Assembler Queues: Immediately clears the production queue of all assemblers currently set to Assembly mode. Use with caution!
- Edit Component List...: Opens a menu to set target quantities for craftable components.
- Select a component and press confirm to edit its target quantity using the Keyboard LCD.
- Select "Add Component by ID..." and enter the exact SubtypeId (e.g., `SteelPlate`, `Computer`) to add it to the list with a target of 0.
- Set Assembler Tag [Edit]: Allows changing the tag used to identify the designated assembler (default is
[AC]
).
Remote Grid Sorting
This feature allows you to pull specific categories of items from connected remote grids into your local base storage.
How it Works
- Grid Discovery: The script periodically scans for other grids accessible through the terminal system (connected via connectors, rotors, pistons, etc.).
- Configuration Per Grid: You can configure sorting rules independently for each discovered remote grid.
- Manual Pull: From the menu for a specific grid, you can trigger an immediate pull of all items belonging to a chosen category (e.g., "Sort Remote Ingots Now").
- Automatic Pull: You can enable automatic, periodic pulling for specific categories from a specific grid (e.g., "Autosort Remote Ores [ON]"). These automatic pulls happen during the sorter's operation cycle.
- Destination: Items pulled from remote grids are placed into local containers tagged with the corresponding category tag (e.g., remote ores go to local
[Ore]
containers).
Configuration (via Sorter Settings -> Remote Grid Settings...)
- Select Grid: Choose the remote grid you want to configure from the list.
- (Grid Actions Menu):
- Auto Manage Settings...: Enter the submenu to toggle automatic sorting for each category for *this specific grid*.
- Sort Remote [Category] Now: Immediately attempts to pull all items of that category from the selected remote grid to local tagged containers.
- Sort All Remote Items Now: Attempts to pull items from *all* categories from the selected remote grid.
- (Auto Manage Settings Menu):
- Toggle individual categories (Ingots, Components, Ores, etc.) ON/OFF for automatic periodic pulling from *this specific grid*. Settings are saved per grid ID.
Note: For remote sorting to work, the grids must be connected via the terminal system (usually connectors locked, or attached via rotors/pistons).
Best Practices & Tips
Performance
- For large bases with many containers/refineries/assemblers, keep the Operation Interval around 10-15 ticks. Very low intervals (1-5) on complex grids can impact simulation speed.
- Adjust the Sorter Moves/Tick setting if you notice performance drops during sorting cycles. Start with the default (20) and decrease if needed.
- Use specific category tags (
[Ing]
,[Com]
, etc.) rather than relying solely on name filtering for better performance and accuracy. - Use the
[NO_SORT]
tag on containers you want the script to completely ignore (personal storage, connector buffers, specific project bins) to reduce unnecessary scanning.
Organization & Reliability
- Have at least one container tagged for each major category (
[Ing]
,[Com]
,[Ore]
) to ensure the sorter has a place to put things. - Consider an
[Unsorted]
container, especially if you enable "Clean Destinations", to catch misplaced items. - Keep Keeper Crate (
[KEEP_STOCK]
) target amounts reasonable. Setting extremely high values might strain your production or resource gathering. - Ensure the assembler tagged
[AC]
is functional, powered, enabled, and has access to necessary ingots via the conveyor system for Auto-Crafting to work. - Use the Auto Door ignore list for doors controlled by other systems (timers, sensors, airlocks) or large hangar doors to prevent conflicts.
- Regularly check the script's log via the menu for warnings or errors.
FAQ & Troubleshooting
Script Issues
- Script doesn't run / "Compiled with errors": Check the PB's terminal screen details tab for error messages. Ensure Experimental Mode is ON in world settings. Verify you have the correct script version.
- Menu not appearing: Double-check the exact names of the LCDs:
BaseManagement LCD
andKeyboard Input LCD
(case-sensitive). - Performance drops (low SIM speed): Increase the "Operation Interval" in the menu. Decrease the "Sorter Moves/Tick". Reduce the number of Keeper Crates or complex sorting rules.
Sorter / Keeper Issues
- Items not sorting: Is "Local Sort" enabled in Sorter Settings? Are destination containers correctly tagged (
[Ing]
,[Com]
, etc.) in Name or Custom Data? Is the source container marked[NO_SORT]
? Are destination containers full (check category cooldown in logs)? - Keeper Crate not filling: Is the
[KEEP_STOCK]
section correctly formatted in Custom Data? Are the item SubtypeIds correct? Are the needed items available in *other* (non-keeper, non-nosort) containers or assembler outputs on the local grid? Is the Sorter enabled? - Wrong items in tagged containers: Enable "Clean Destinations" in the Sorter Settings menu. Ensure an
[Unsorted]
container exists if possible.
Other Feature Issues
- Refinery not prioritizing correctly: Check the "Edit Ore Priority List" in the Refinery menu. Ensure desired ores are high on the list. Is the Refinery module enabled? Are source ores available? Is the refinery input empty or processing the *correct* highest-priority ore already?
- Auto Doors not closing: Is "Auto Doors" enabled? Is the "Close Delay" > 0? Is the specific door or its group in the "Manage Ignore List"?
- Auto Crafting not working: Is "Auto Crafting" enabled? Is exactly one *functional*, *enabled* assembler tagged correctly (default
[AC]
)? Are the desired quantities set > 0? Does the assembler have power and conveyor access to ingots? Check the script log for cooldown messages. - Remote Sorting not working: Is the remote grid connected via the terminal system (connectors, rotors etc.)? Did you enable automatic sorting for the desired categories for that specific grid in the "Remote Grid Settings" -> "(Grid Name)" -> "Auto Manage Settings..." menu? Are correctly tagged local destination containers available and not full?