We are currently experiencing issues with email delivery; this is being resolved as quickly as possible.

stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. HASH() and named devices: lbn and sbn

Chapter 4 · Data network

HASH() and named devices: lbn and sbn

No more six-pin limit: address devices across the whole data network by type and name.

Lesson 10 of 18 11 min

Six pins fill up fast. And when you rebuild a device, you have to set the pin again. Better: address devices through the data network.

Every device has a type hash

Every device type has an internal name, the prefab, for example StructureGasSensor. The game turns it into a number, the hash. You do not need to know the number – HASH("…") computes it when the code loads:

define SENSOR HASH("StructureGasSensor")   # Gas Sensor

You find prefab names in the prefab search of the IC10 coder.

You choose the names

With the labeller you give devices a name in game, such as “Storage”. HASH("Storage") turns that into a number as well.

lbn and sbn

lbn temp SENSOR HASH("Storage") Temperature Average
sbn HEATER HASH("StorageHeat") On 1
  • lbn reads the value from all devices of that type with that name and combines it. Average takes the mean – more about that in the next lesson.
  • sbn writes the value into all matching devices at once. Three heaters named “StorageHeat”? One line switches all three.
Tip

Use plain ASCII in HASH("…"). The chip only stores ASCII; with special characters the hash no longer matches the device name.

Note

Without a name there are lb and sb: they hit every device of a type on the network. Handy for “all lights off”.

Diagram

Devices on the data network with type and name IC housing IC10 StructureGasSensor „Lager“ StructureGasSensor „Werkstatt“ StructureWallHeater „Lagerheizung“ StructureWallHeater „Lagerheizung“ StructureWallHeater „Werkstattheizung“ lbn SENSOR HASH("Lager") reads only this sensor sbn HEATER HASH("Lagerheizung") switches both at once
lbn and sbn reach every device on the same data network. They select by type (prefab hash) and by the name you give with the labeller.

Exercise

Task

The data network holds two gas sensors (“Lager” and “Werkstatt”) and three wall heaters – two named “Lagerheizung”, one “Werkstattheizung”.

When the Lager is colder than 5 °C (278.15 K), both Lagerheizung heaters should run, otherwise off. The Werkstattheizung stays untouched.

Use lbn/sbn with HASH("…") – no pins d0–d5. Prefabs: StructureGasSensor, StructureWallHeater.

Hints

Hint 1

Read: lbn temp SENSOR HASH("Lager") Temperature Average.

Hint 2

Compare as in the select lesson: slt on temp LIMIT.

Hint 3

Write into both heaters at once: sbn HEATER HASH("Lagerheizung") On on.

Esc
↑ ↓ selectEnter open/ opens search anywhere