What you learn today
- New and deprecated LogicTypes
- Check prefab names
- Test old scripts
After a game update the production counter stops counting. No error on the housing, the autolathe simply keeps running. What changed is written nowhere in the chip. Updates are a special kind of silent error: the code is the same, the world around it is not.
What can change in updates
| What | Effect in the chip |
|---|---|
| new LogicTypes | nothing – old scripts keep running, new ones can do more |
| LogicType marked as deprecated | is still read, but returns nothing on newer devices |
| device no longer knows a LogicType | error IncorrectLogicType or silently 0, depending on the case |
| prefab name different or misspelt | HASH("…") finds no device, Average silently returns NaN |
deprecated instructions (ld, sd, getd, putd, label) | keep running, l and s do the same |
An example of a name that never existed: RatioVolatiles. In the chip volatiles are called RatioMethane, a script with the wrong name does not even load. And some prefab names contain typos of the game itself, such as StructurePipeAnalysizer. Whoever “corrects” them no longer finds the device.
Checking prefab names
Every name in HASH("Structure…") must be exactly as in the current list – including upper and lower case. StructureAutoLathe and StructureAutolathe are two different hashes. The checker in the IC10 coder knows the list and marks unknown prefabs.
So that a wrong name does not stay silent, the script checks whether its device answers at all:
lbn present DREHBANK HASH("Drehbank") On Average # NaN if the name does not match
snanz present present
lbn pieces DREHBANK HASH("Drehbank") ExportCount Sum
Testing old scripts
After an update go through every important script like this:
- Open it in the IC10 coder. The checker marks deprecated LogicTypes and instructions yellow, unknown ones red.
- Switch on strict mode in the simulator. It only allows LogicTypes the device really knows.
- Repeat the script's test cases in the game: normal case, edge case, failure.
- Enter the new
GameVersionin the instruction.xml once everything fits.
Sum is right for piece counts, but does not reveal a missing device: without a match Sum returns 0, not NaN. That is why you check for presence via a second value with Average.
Exercise
Task
The script from the forum was written for an older game version. Bring it up to date: correct prefab name of the autolathe, ExportCount instead of the deprecated ExportQuantity, no deprecated instruction. The autolathe “Drehbank” runs until 20 pieces are made, the display “Stueckzahl” shows the count – and -1 if the autolathe is not found.
Hints
Hint 1
The prefab is called StructureAutolathe – with a lower-case l.
Hint 2
label d0 … is deprecated and unnecessary here: the autolathe is already called “Drehbank” in the game.
Hint 3
Check presence via lbn … On Average and snanz, then show the fault value with select.
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