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

Day 215 of 365 · Pro · Month 8: Production

Reading reagents: lr

With lr the chip reads what has melted in the furnace: Contents per reagent, TotalContents for everything, Required and Recipe on fabricators. Reagents are named via HASH.

Lesson 20 min Week 31

What you learn today

  • Contents, Required, Recipe and TotalContents
  • Reagent hash
  • Check amounts

The furnace reports RecipeHash 0 although temperature and pressure are right. Something is wrong with the mixture – too much iron? Too little carbon? So far the chip could only read the total amount. With lr it sees every single material.

The instruction

lr iron id Contents IRON

lr r? device mode reagent reads a reagent amount. The device is a pin, a register with a ReferenceId or an ID. The four modes:

ModeNumberreturns
Contents0how much of this reagent is in the device
Required1how much of it the current recipe still lacks
Recipe2how much of it the current recipe needs in total
TotalContents3the sum of all reagents – the reagent is ignored

TotalContents returns the same as the LogicType Reagents you already know.

The reagent hash

You give the reagent as the hash of its name: HASH("Iron"), HASH("Carbon"), HASH("Copper"), HASH("Nickel"), HASH("Gold"), HASH("Silver"), HASH("Lead"), HASH("Silicon"). Alloys are reagents too: HASH("Steel"), HASH("Invar"). Coal ore gives HASH("Hydrocarbon"), charcoal HASH("Carbon").

The names are English and exact – HASH("Eisen") gives a number that is no reagent, and lr returns 0.

The device by ReferenceId

lr needs a single device. You get the furnace's ReferenceId by name, and with bdns you check whether it is there at all:

lbn id FURNACE HASH("Ofen") ReferenceId Average
bdns id missing

Which modes work where

Contents and TotalContents work on everything that holds molten material: furnaces, arc furnace, recycler, centrifuge, fabricators. Required and Recipe only exist on fabricators that work through a recipe, such as the autolathe.

Warning

lr … Required on a furnace is no harmless error: the chip reports IncorrectReagentDevice and stops. Check which device you are dealing with before you use Required or Recipe.

Checking amounts

For steel the iron share should be around 75 %. The chip calculates iron divided by total and checks a band from 70 to 80 %. If the furnace is empty, the total is 0 and the share NaN – sge with NaN gives 0, the light stays off. Exactly right: an empty furnace has no good mixture.

Exercise

Task

Read the amounts of iron and carbon (Contents) from the furnace “Ofen” with lr and the total with the LogicType Reagents. Show them on “Eisen”, “Kohle” and “Gesamt”. The light “Mischung” is on when the iron share is between 70 and 80 %. If the furnace is missing (bdns): all three displays −1, light off.

Hints

Hint 1

Right after the lbn: bdns id missing, at the bottom a section missing: of its own with j start at the end.

Hint 2

lr iron id Contents IRON, the same for carbon, l total id Reagents.

Hint 3

Share: div share iron total, then sge/sle and and.

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