stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 92

Day 92 of 365 · Advanced · Month 4: Network in detail

Slots on the network: lbns

lbns reads a slot only on the devices with the matching name. That way you count iron and copper separately even if all lockers are of the same type.

Lesson 12 min Week 14

What you learn today

  • Compare lbs and lbns
  • Specific lockers by name
  • Batch mode for slots

The store holds twelve small lockers. Three are called “Eisen”, two “Kupfer”, the rest “Werkzeug”. With lbs you read a slot of all lockers of the type. For the question “how much iron do I have?” you only need the lockers with the right name. That is exactly what lbns does.

lbs and lbns compared

lbs r0 LOCKER 0 Quantity Sum                 # slot 0 of all lockers
lbns r1 LOCKER HASH("Eisen") 0 Quantity Sum  # only lockers "Eisen"
Instructionfilters byoperands
lbstyper? hash slot SlotType mode
lbnstype and namer? hash nameHash slot SlotType mode

lbns relates to lbs like lbn to lb. The name comes third, right after the prefab hash.

Batch mode for slots

The batch modes work the same here, with the same results for zero matches:

QuestionMode
How many items in total?Sum
How full is the emptiest battery in the chargers “Werkzeug”?Minimum
Is anything ripe in the trays “Tomaten”?Maximum
How far are the plants on average?Average

With Sum a missing locker returns 0, with Average NaN. For a store 0 is the more honest answer: where there is no locker, there is no iron either.

All slots of one name

As with lbs the slot number may sit in a register. A loop then counts all slots of the lockers with one name:

move total 0
move i 0
slot:
lbns value LOCKER HASH("Eisen") i Quantity Sum
add total total value
add i i 1
blt i SLOTS slot
Warning

A name only hits devices of the same type. A small locker “Eisen” and a large locker “Eisen” are two different prefabs. lbns with the hash of the small locker does not see the large one.

Tip

An LED display may have the same name as the lockers whose contents it shows. The type tells them apart. That way the name on the display matches the storage place.

Diagram

Three readings, five batch modes Sensor “Raum” 300 K Sensor “Raum” 310 K Sensor “Raum” 250 K lbn Average 286.67 Sum 860 Minimum 250 Maximum 310 Count 3 Sum on temperatures: 860 K – the heater thinks there is a fire.
lbs filters by type, lbns by name as well. The batch mode combines the matches.

Exercise

Task

The store holds small lockers (StructureLockerSmall, 4 slots) named “Eisen” (two of them), “Kupfer” and “Werkzeug”.

  • LED display “Eisen”: all items in all slots of the lockers “Eisen”
  • LED display “Kupfer”: the same for “Kupfer”
  • If a locker is missing, it simply does not count – without an error.

Hints

Hint 1

Reset the totals and i to 0 at the start of every pass.

Hint 2

Inside the loop lbns … i Quantity Sum twice, once with HASH("Eisen"), once with HASH("Kupfer").

Hint 3

After the loop write both displays with sbn.

Quiz

4 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed the simulator exercise
  • Passed the quiz with at least 60 %

Without an account progress is saved in this browser only.

Report a mistake in this lesson

Please sign in to report. Sign in

Esc
↑ ↓ selectEnter open/ opens search anywhere