Quick answer
The starter biology loop has two separate jobs. The bio collector scans for nearby sites and collects one specimen when its cargo is empty. The biology lab then pulls that specimen from the collector, analyzes it, loads the required reagents, and extracts the sample. The key lesson is that hardware actions stay local to the machine running the script.
Step 1: collector loop
A minimal starter shape from the walkthrough is:
while True:
if self.cargo != 0:
pass
else:
sites = self.scan()
if len(sites) > 0:
target = sites[0]
self.collect(target.coords)
The important idea is simple: if the collector already has cargo, wait. If it does not, scan, choose an available site, and collect a specimen.
Step 2: move the specimen into the lab
The lab can reference the collector, but the lab should perform lab hardware actions through self.
collector = get_component("bio collector one")
if not self.input:
self.take_from(collector)
That reads naturally as “Biology lab, take the specimen from that collector.”
Step 3: analyze before reading the recipe
if self.input and self.input.stage == "collected":
info = self.analyze()
Do not read self.input.recipe before an analyzed specimen has produced recipe data. The recorded run hits exactly that kind of None/state error while building the loop.
Step 4: load the recipe and extract
The walkthrough describes the recipe as a dictionary of reagent IDs and required quantities. That makes the natural automation shape:
recipe = self.input.recipe
for reagent in recipe.keys():
need = recipe[reagent]
loaded = self.loaded_reagents.get(reagent, 0)
if loaded < need:
self.load(reagent, need - loaded)
self.extract()
Core programming lessons from the biology system
selfis local. In the collector script, it means the collector. In the lab script, it means the lab.- Lists have indexes.
scan()returns candidate sites;sites[0]is the first one. - State matters. Check cargo/input/stage before telling the machine what to do next.
- Dictionaries hold recipe quantities. The analyzed specimen exposes the reagent needs by key.
Why the loop may stall
- The collector cargo is full, so its script is correctly waiting for the lab.
- The lab has no input because the collector never completed a collection.
- The lab tries to read a recipe before analysis created it.
- The scripts are valid, but the power system dipped and one of the machines is not running.