What you learn today
- Find prefab names in the prefab search
- Know the game's typos
- Store the hash as a define
In the game the thing is called “Lever” – and in code StructureLogicSwitch. Guessing prefab names often goes wrong. And a wrong name gives no error message: HASH("StructureLever") is a valid number, there is just no device that belongs to it.
Display name and prefab name
| Stationpedia | Prefab |
|---|---|
| Lever | StructureLogicSwitch |
| Switch | StructureLogicSwitch2 |
| Button | StructureLogicButton |
| LED Display (Small) | StructureConsoleLED5 |
| Station Battery | StructureBattery |
| Gas Sensor | StructureGasSensor |
You find the names in the prefab search of the IC10 coder: type the English or German name, read off prefab and hash.
The game's typos
Some prefabs are misspelt in the game itself. You have to copy them exactly like that:
| Device | Prefab |
|---|---|
| Pipe Analyzer | StructurePipeAnalysizer |
| Heat exchanger gas to gas | StructureHeatExchangerGastoGas |
| Wall (Geometry Straight) | StructureWallGeometryStreight |
Upper and lower case count as well: HASH("structuregassensor") is an entirely different number.
Looking it up in the game
Every device with logic reports its own hash in the LogicType PrefabHash. Attach an unknown device to a pin and the housing shows you the number:
l r0 d0 PrefabHash
s db Setting r0 # hash of the device on d0
You compare the number with the prefab search – or store it directly as a define.
Storing the hash as a define
Two notations, same result:
define SENSOR HASH("StructureGasSensor") # Gas Sensor
define SENSOR2 -1252983604 # Gas Sensor
The chip computes HASH("…") on load, you never need to know the number. For the character limit, though, the written long form counts: the number is shorter, the name more readable. In the workshop style either one is used – the name inside HASH or the number – always with the English device name in the comment.
A typo in the prefab name goes unnoticed. lbn with Average then returns NaN, sbn writes into no device. So check new defines once with the prefab search.
Never a raw hash number in the body. Whoever reads -1252983604 in the middle of the code has no idea what is meant. With a define the name sits next to it.
Diagram
Exercise
Task
This tank display shows nothing: all three prefab names were guessed wrong. The network holds a Pipe Analyzer “Tank”, a Lever “Freigabe” and an LED Display (Small) “Tankdruck”.
Fix the three defines. The display then shows the tank pressure while the lever is flipped, otherwise 0.
Hints
Hint 1
The prefab search of the IC10 coder finds all three by their English name.
Hint 2
The Pipe Analyzer has a typo in the game – “Analysizer”.
Hint 3
Lever is StructureLogicSwitch, the small LED display StructureConsoleLED5.
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