What you learn today
- Count stock
- Report minimum amounts
- Display per class
At the end of the logistics weeks the store gets a manager: it knows how much of every class is there and speaks up before something runs out.
The plant
| Device | Prefab | Name |
|---|---|---|
| locker | StructureStorageLocker | “Hauptlager” |
| four LED displays | StructureConsoleLED5 | “Rohstoffe”, “Erze”, “Eis”, “Mangel” |
| wall light | StructureWallLight | “Mangel” |
Counting stock
The loop over all 30 slots reads SortingClass and Quantity per slot. There is one sum for each of the three classes; a slot only counts towards its own class:
seq tmp class ORES
select tmp tmp amount 0
add ore ore tmp
Items of other classes – tools, kits, empty cans – count nowhere.
Reporting minimum amounts
| Shortage | Class | Minimum amount |
|---|---|---|
| 1 | resources | 100 |
| 2 | ores | 50 |
| 3 | ice | 20 |
| 4 | store unreachable | – |
The display “Mangel” shows the most important class that is undercut. Resources are the most important, because nothing gets built without ingots. So checking goes from ice over ores to resources, and the missing store comes last of all.
Display per class
Every class has its own display. If the locker is missing, all three show −1, and “Mangel” jumps to 4.
Milestones
- Count resources
- Count ores and ice separately, leave out other classes
- Report minimum amounts by priority
- Everything there: shortage 0, light off
- Store missing: −1 on all displays, shortage 4
Several lockers named “Hauptlager”? Then Average readings average over all of them – the sums are no longer right. For several stores you switch to Sum and count real piece counts over all lockers with it. You then read the class per locker separately, via names of their own.
Project task
Task
Build the warehouse management following the tables. Count the amounts of the classes Resources, Ores and Ices in the 30 slots of the locker “Hauptlager” and show them on “Rohstoffe”, “Erze”, “Eis”. “Mangel” shows the most important minimum amount that is undercut (or 0), the light “Mangel” is on for every shortage. If the locker is missing: displays −1, shortage 4.
Milestones
- Milestone 1: count resources
- Milestone 2: ores and ice separately
- Milestone 3: shortage by priority
- Milestone 4: everything there
- Milestone 5: store missing
Hints
Hint 1
Per class: seq tmp class …, select tmp tmp amount 0, add.
Hint 2
Missing store: read the locker's PrefabHash and snan; with it set all three sums to −1.
Hint 3
Shortage: ice, ores, resources, finally the missing store – each with select short … short.
Quiz
2 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed all milestones of the project
- 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