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

Day 325 of 365 · Expert · Month 11: Optimisation and debugging

Sharing scripts

Sharing scripts: the library in the game and on the website, the layout of instruction.xml, marking versions and a self-test for other people's bases.

Lesson 18 min Week 47

What you learn today

  • Library and workshop
  • Instruction.xml
  • Mark versions

Your cold room script has been running without errors for weeks. A friend wants it too. From now on it runs in a base you have never seen, with devices named differently, on a game version that may be newer. Sharing means: the script has to manage without you.

Where scripts live

In the game the IC editor stores every script in the library. On disk that is one folder per script:

Documents\My Games\Stationeers\scripts\<Title>\instruction.xml

The IC10 coder on this site can export this file and read it back in. And in the website's IC10 library you publish a script so that others can view it, test it in the simulator and take it over.

The instruction.xml

<InstructionData>
  <DateTime>638652480000000000</DateTime>
  <GameVersion>0.2.6428.27798</GameVersion>
  <Title>Kuehlhaus v3</Title>
  <Description>3 sensors, emergency mode. New: check setpoint</Description>
  <Author>Dominik1199</Author>
  <WorkshopFileHandle>0</WorkshopFileHandle>
  <Instructions>...the code, XML-escaped...</Instructions>
</InstructionData>
FieldContent
DateTimepoint in time in .NET ticks (100 ns steps since year 1)
GameVersiongame version you saved with
Title, Description, Authorwhat others see in the library
WorkshopFileHandlelink to the Steam Workshop, 0 = not linked
Instructionsthe code; <, > and & appear there as &lt;, &gt;, &amp;

Marking versions

Three places, one number: define VERSION 3 in the code, “v3” in the title, and in the description what is new. The GameVersion adds which game version you tested with.

A self-test for other people's bases

What works for you usually fails for someone else because a device is missing or named differently. Let the chip report that itself. Every required device gets a bit in a code, and a display shows it:

snan code temp                      # bit 0: sensor missing
snan tmp heat
ins code tmp 1 1                    # bit 1: heater missing
sbn ANZ HASH("Info") Setting code   # 0 = everything present

If the display shows 2, the heater “Raum” is missing – anyone can find that without asking.

Tip

Average helps with the self-test: if a device is missing, every value becomes NaN, even an On. With Sum a 0 would come out silently instead.

Exercise

Task

Make the room heating shareable: at start VERSION is on the housing. Every pass the display “Info” shows a self-test code: bit 0 = sensor “Raum” missing, bit 1 = heater “Raum” missing, 0 = everything present. Without a sensor the heater stays off. The control (19/21 °C) stays as it is.

Hints

Hint 1

s db Setting VERSION before the loop label.

Hint 2

snan for the sensor gives bit 0, snan for the heater with ins code tmp 1 1 gives bit 1.

Hint 3

If the heater is missing, its On is NaN: select heat tmp 0 heat turns it into 0 before and and or calculate. If the sensor is missing, the hysteresis switches off on its own with NaN.

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