<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://stationeers-wiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Datzu</id>
	<title>Stationeers Community Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://stationeers-wiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Datzu"/>
	<link rel="alternate" type="text/html" href="https://stationeers-wiki.com/Special:Contributions/Datzu"/>
	<updated>2026-04-03T20:50:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://stationeers-wiki.com/index.php?title=IC10&amp;diff=23816</id>
		<title>IC10</title>
		<link rel="alternate" type="text/html" href="https://stationeers-wiki.com/index.php?title=IC10&amp;diff=23816"/>
		<updated>2025-10-26T11:58:00Z</updated>

		<summary type="html">&lt;p&gt;Datzu: Add repor with lots of code examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:IC10 Programming]]&lt;br /&gt;
=Scripting language for IC10 housings / chips=&lt;br /&gt;
MIPS is [[Stationeers]]&#039; inspiration for the in-game scripting language called IC10. It runs on [[Integrated Circuit (IC10)|IC10 chips]] crafted at the [[Electronics Printer]]. &lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
Internal registers &#039;&#039;&#039;r?&#039;&#039;&#039;: The IC contains 16 CPU registers, numbered &#039;&#039;&#039;r0&#039;&#039;&#039; to &#039;&#039;&#039;r15&#039;&#039;&#039;. From now on referred to as &#039;&#039;&#039;r?&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Device registers &#039;&#039;&#039;d? logicType&#039;&#039;&#039;: Device registers are written to and from the IC. A device register is numbered &#039;&#039;&#039;d0&#039;&#039;&#039; to &#039;&#039;&#039;d5&#039;&#039;&#039; (select via screw), or &#039;&#039;&#039;db&#039;&#039;&#039; (connected device). From now on referred to as &#039;&#039;&#039;d?&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Logic and algorithmic with &#039;&#039;&#039;Internal registers&#039;&#039;&#039; ===&lt;br /&gt;
All calculations are exclusively performed to and from &#039;&#039;&#039;r?&#039;&#039;&#039; registers, or generally more understood as variables in programming. You can use aliases to give convenient names with the &amp;lt;code&amp;gt;alias string r?|d?&amp;lt;/code&amp;gt;command (see below). &lt;br /&gt;
&lt;br /&gt;
Internal registers can be manipulated in various ways. &lt;br /&gt;
* Write constant values &amp;lt;code&amp;gt;move r? (r?|num)&amp;lt;/code&amp;gt;: Example: &amp;lt;code&amp;gt;move r0 2&amp;lt;/code&amp;gt; sets r0 to the number 2.&lt;br /&gt;
* Calculate: Calculations are done to- and from these registers, like &amp;lt;code&amp;gt;add r? a(r?|num) b(r?|num)&amp;lt;/code&amp;gt;. Example: &amp;lt;code&amp;gt;add r1 r0 3&amp;lt;/code&amp;gt; adds 3 to r0, and writes to r1.&lt;br /&gt;
&lt;br /&gt;
Note, for any kind of if statements or loop behaviours, knowing about labels, branching, and jumps is essential knowledge. See below.&lt;br /&gt;
&lt;br /&gt;
=== IO to &#039;&#039;&#039;Device registers&#039;&#039;&#039; ===&lt;br /&gt;
Acronym &#039;&#039;&#039;d?&#039;&#039;&#039; stands for device, where ? is a number corresponding to the screw device selector on the socket.&lt;br /&gt;
You can also read/write to the device where the IC is planted in using device &#039;&#039;&#039;db&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Generally, there are up to 6 devices which can be set using the screwdriver &#039;&#039;&#039;d0&#039;&#039;&#039; to &#039;&#039;&#039;d5&#039;&#039;&#039;. A special device register &#039;&#039;&#039;db&#039;&#039;&#039; is the device wherever the IC is mounted upon. Very convenient for atmospheric devices where no separate IC socket is required.&lt;br /&gt;
&lt;br /&gt;
Note, the IC is completely unaware where d? is actually connected to. So if you get a logicType error, check d? number, or check if the screw has been set on the socket. An alias is only convenient to convey what is expected to be set on the d? screw, it does not actually set or program the screw.&lt;br /&gt;
&lt;br /&gt;
* Read from device (load) &amp;lt;code&amp;gt;l r? d? logicType&amp;lt;/code&amp;gt;: Reads logicType, like Pressure from a [[Sensors|gas sensor]], from device d? to register r?. Values can be read from connected devices and put into the register using the &#039;&#039;&#039;l&#039;&#039;&#039; (load) command. For example, if you want to load the state of a door. &amp;lt;br&amp;gt; Example: &amp;lt;code&amp;gt;l r0 Door Open&amp;lt;/code&amp;gt; reads the &#039;Open&#039; field of an object named &#039;Door&#039;, that would be connected to the IC housing of the chip.&lt;br /&gt;
* Write to a device (set) &amp;lt;code&amp;gt;s d? logicType r?&amp;lt;/code&amp;gt;: Write a value from a register back to a device using the command &amp;lt;code&amp;gt;s d? logicType r?&amp;lt;/code&amp;gt;. For example, if d0 is set to a door using the screwdriver, &amp;lt;code&amp;gt;s d0 Open 0&amp;lt;/code&amp;gt; sets the &#039;Open&#039; status of the d0 (a door) to 0, effectively closing the door.&lt;br /&gt;
&lt;br /&gt;
=== batch IO to - &#039;&#039;&#039;Device registers&#039;&#039;&#039; ===&lt;br /&gt;
&#039;&#039;&#039;Batch writing&#039;&#039;&#039; needs to be done to a specific &#039;&#039;&#039;deviceHash&#039;&#039;&#039; instead of d?. Is unique per device type, which you can find in the [[Stationpedia]] entries.&lt;br /&gt;
* &amp;lt;code&amp;gt;lb r? deviceHash logicType batchMode&amp;lt;/code&amp;gt; &lt;br /&gt;
* &amp;lt;code&amp;gt;sb deviceHash logicType r?&amp;lt;/code&amp;gt;&lt;br /&gt;
Additionally, using the following batch commands, a &#039;&#039;&#039;nameHash&#039;&#039;&#039; can be provided to only modify devices with a certain name.&lt;br /&gt;
* &amp;lt;code&amp;gt;lbn r? deviceHash nameHash logicType batchMode &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sbn deviceHash nameHash logicType r?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All hashes used in the game are CRC-32 checksums computed from the strings they represent.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;batchMode&#039;&#039;&#039; is a parameter equal to 0, 1, 2, or 3. These are also defined as the constants &#039;&#039;&#039;Average&#039;&#039;&#039;, &#039;&#039;&#039;Sum&#039;&#039;&#039;, &#039;&#039;&#039;Minimum&#039;&#039;&#039;, and &#039;&#039;&#039;Maximum&#039;&#039;&#039; respectively. The word or number can be used.&lt;br /&gt;
&lt;br /&gt;
Combining one of these functions with the &amp;lt;code&amp;gt;HASH()&amp;lt;/code&amp;gt; function can be advantageous:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lbn r0 HASH(&amp;quot;StructureGasSensor&amp;quot;) HASH(&amp;quot;Sensor 1&amp;quot;) Temperature Average&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code will load the average temperature of all gas sensors on the network named &amp;quot;Sensor 1&amp;quot; onto register &#039;&#039;&#039;r0&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the batch read (lb/lbn) is done on a network without any matching devices the results will be as specified in the table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Batch read with no devices&lt;br /&gt;
|-&lt;br /&gt;
! Batch Mode !! Result&lt;br /&gt;
|-&lt;br /&gt;
| Average (0) || nan&lt;br /&gt;
|-&lt;br /&gt;
| Sum (1) || 0&lt;br /&gt;
|-&lt;br /&gt;
| Minimum (2) || inf&lt;br /&gt;
|-&lt;br /&gt;
| Maximum (3) || ninf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
Here are some examples demonstrating all three operations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;move r0 10&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;Sets register &#039;&#039;&#039;r0&#039;&#039;&#039; to the value 10&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;move r0 r1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;Copies the value of register &#039;&#039;&#039;r1&#039;&#039;&#039; to register &#039;&#039;&#039;r0&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;l r0 d0 Temperature&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;Reads the Temperature parameter from device &#039;&#039;&#039;d0&#039;&#039;&#039; and places the value in register &#039;&#039;&#039;r0&#039;&#039;&#039;.&lt;br /&gt;
Note: not all devices have a Temperature parameter, check the in-game stationpedia.&lt;br /&gt;
&lt;br /&gt;
To set a device specific value (like &#039;&#039;&#039;On&#039;&#039;&#039;), you can write into this value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;s d0 On r0&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;Writes the value from register &#039;&#039;&#039;r0&#039;&#039;&#039; out to &#039;&#039;&#039;On&#039;&#039;&#039; parameter of device &#039;&#039;&#039;d0&#039;&#039;&#039;. In this example the device will be turned On, if valve of register r0 equals 1, otherwise (register r0 equals 0) it will turned off. See section [[IC10#Device_Variables|Device Variables]].&lt;br /&gt;
&lt;br /&gt;
It&#039;s recommended to use labels (like: &#039;&#039;someVariable&#039;&#039;) instead of a direct reference to the register. See &#039;&#039;&#039;alias&#039;&#039;&#039; in section [[IC10#Instructions|Instructions]].&lt;br /&gt;
&lt;br /&gt;
=== Special registers ===&lt;br /&gt;
There are two more registers. One called &#039;&#039;&#039;ra&#039;&#039;&#039; (return address) and one called &#039;&#039;&#039;sp&#039;&#039;&#039; (stack pointer). The &#039;&#039;&#039;ra&#039;&#039;&#039; is used by certain jump and branching instructions (those ending with &#039;&#039;&#039;-al&#039;&#039;&#039;) to remember which line in the script it should return to. The &#039;&#039;&#039;sp&#039;&#039;&#039; tracks the next index within the stack (a memory that can store up to 512 values) to be pushed (written) to or popped (read) from. Neither &#039;&#039;&#039;ra&#039;&#039;&#039; nor &#039;&#039;&#039;sp&#039;&#039;&#039; is protected, their values can be changed by instructions like any other register.&lt;br /&gt;
&lt;br /&gt;
==Stack Memory==&lt;br /&gt;
The Stack is a memory that can hold 512 different values. Each IC10 has its own Stack, and some devices (like the Logical Sorter) also have a Stack.&lt;br /&gt;
;push r?: adds the value  &#039;&#039;&#039;r?&#039;&#039;&#039; and increments the &#039;&#039;&#039;sp&#039;&#039;&#039; by 1.&lt;br /&gt;
;pop r?: loads the value in the stack memory at index &amp;lt;code&amp;gt;sp-1&amp;lt;/code&amp;gt; into register &#039;&#039;&#039;r?&#039;&#039;&#039; and decrements the &#039;&#039;&#039;sp&#039;&#039;&#039; by 1.&lt;br /&gt;
;peek r?: loads the value in the stack memory at index &amp;lt;code&amp;gt;sp-1&amp;lt;/code&amp;gt; into register &#039;&#039;&#039;r?&#039;&#039;&#039;.&lt;br /&gt;
;get r? d? address(r?|num): loads the value in the stack memory at index &amp;lt;code&amp;gt;address&amp;lt;/code&amp;gt; on provided device into register &#039;&#039;&#039;r?&#039;&#039;&#039;.&lt;br /&gt;
;getd r? id(r?|num) address(r?|num): loads the value in the stack memory at index &amp;lt;code&amp;gt;address&amp;lt;/code&amp;gt; on provided device id into register &#039;&#039;&#039;r?&#039;&#039;&#039;.&lt;br /&gt;
;put d? address(r?|num) value(r?|num): adds the value to the stack memory off the provided device at index &amp;lt;code&amp;gt;address&amp;lt;/code&amp;gt;.&lt;br /&gt;
;putd id(r?|num) address(r?|num) value(r?|num) : adds the value to the stack memory off the provided device id at index &amp;lt;code&amp;gt;address&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, &#039;&#039;&#039;sp&#039;&#039;&#039; can be both written to and read from any time. When reading (&#039;&#039;&#039;peek&#039;&#039;&#039; or &#039;&#039;&#039;pop&#039;&#039;&#039;), &#039;&#039;&#039;sp&#039;&#039;&#039; must be between 1 and 512, inclusive. While writing (&#039;&#039;&#039;push&#039;&#039;&#039;), &#039;&#039;&#039;sp&#039;&#039;&#039; must be between 0 and 511, inclusive.&lt;br /&gt;
&lt;br /&gt;
Stack memory is persistent on logic chips. This means that if you have a logic chip and push values to the stack, the code that pushes those values can be removed and the stack will retain those values.&lt;br /&gt;
&lt;br /&gt;
Note that this does not carry over to any other logic chips which receive the program of the original; They will need to have their stack memories programmed individually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stack Traversing&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Traversing the stack can be done similarly to how an array would be traversed in some other languages:&lt;br /&gt;
{{ICCode|&lt;br /&gt;
#this will traverse indices {min value} through {max value}-1&lt;br /&gt;
move sp {min value}&lt;br /&gt;
loop:&lt;br /&gt;
add sp sp 1&lt;br /&gt;
peek r0&lt;br /&gt;
&lt;br /&gt;
#do something here with your stack values (loaded into r0)&lt;br /&gt;
&lt;br /&gt;
blt sp {max value} loop&lt;br /&gt;
&lt;br /&gt;
#continue on&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can use the pop function&#039;s decrementing to make a more efficient loop:&lt;br /&gt;
{{ICCode|&lt;br /&gt;
move sp {max value}&lt;br /&gt;
add sp sp 1&lt;br /&gt;
loop:&lt;br /&gt;
pop r0&lt;br /&gt;
&lt;br /&gt;
#do something here with your stack values (loaded into r0)&lt;br /&gt;
&lt;br /&gt;
bgt sp {min value} loop&lt;br /&gt;
&lt;br /&gt;
#continue on&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Comments==&lt;br /&gt;
Comments can be placed using a &#039;&#039;&#039;#&#039;&#039;&#039; symbol. All comments are ignored by the game when it reads commands. Below is an example of valid code with two comments.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
alias MyAlias r0 # Text after the hash tag will be ignored to the end of the line.&lt;br /&gt;
# You can also write comments on their own lines, like this.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Device Ports==&lt;br /&gt;
ICs can interact with up to 6 other devices via d0 - d5, as well as the device it&#039;s attached to via db. To change or set a device, use a screwdriver and adjust the device in the IC housing. You can read or set any of the device&#039;s properties, so it is possible to do things like read the pressure or oxygen content of a room on the same Device port. &lt;br /&gt;
&lt;br /&gt;
Additionally, it&#039;s possible to set other IC housings as devices, allowing you to create programs that run across multiple ICs together. For example, an Gas Mixing IC could check the &#039;&#039;&#039; Setting&#039;&#039;&#039;  field of a Atmosphere Sensor IC and act based on the value of the sensor chip.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;l&#039;&#039;&#039; (load) or &#039;&#039;&#039;s&#039;&#039;&#039; (set) instructions you have to read or set these values to your device. Examples:&lt;br /&gt;
{{ICCode|&lt;br /&gt;
#Reads the &#039;Temperature&#039; from an atmosphere sensor&lt;br /&gt;
# at device port &#039;d0&#039; into register &#039;r0&#039;.&lt;br /&gt;
l r0 d0 Temperature&lt;br /&gt;
}} &lt;br /&gt;
{{ICCode|&lt;br /&gt;
# Writes the value of the register &#039;r0&#039; to the&lt;br /&gt;
# device on port &#039;d1&#039; into the variable &#039;Setting&#039;.&lt;br /&gt;
s d1 Setting r0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
Labels are used to make it easier to jump between lines in the script. The label will have a numerical value that is the same as its line number. Even though it&#039;s possible to use a labels value for calculations, doing so is a bad idea since any changes to the code can change the line numbers of the labels.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
main: # define a jump mark with label &#039;main&#039;&lt;br /&gt;
j main # jumps back to &#039;main&#039;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
Instead of using a register to store a fixed value, a constant can be made. Using this name will refer to the assigned value. With the help of Constants you can save register places.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
# defines a Constant with name &#039;pi&#039;&lt;br /&gt;
# and set its value to 3.14159&lt;br /&gt;
define pi 3.14159&lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
You can use these constants like any other variables (see: alias in section [[IC10#Instructions|Instructions]]). Example:&lt;br /&gt;
{{ICCode|&lt;br /&gt;
# set the value of register &#039;r0&#039; to the value of constant named &#039;pi&#039;.&lt;br /&gt;
move r0 pi &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Numeric values==&lt;br /&gt;
Registers and constants are usually decimal values using double-precision floating point (confirmed?).&lt;br /&gt;
&lt;br /&gt;
Unlike real CPU architectures, integers are not supported as a distinct type, but double FP can represent integers up to about 54 bits before rounding causes problems (the exact number depending what bit patterns you happen to have).&lt;br /&gt;
&lt;br /&gt;
Numbers can be written in hexadecimal by preceding the value with a $ symbol. Values larger than 54 bits might get corrupted. Hex numbers are typically used for ReferenceId values.&lt;br /&gt;
&lt;br /&gt;
Examples: &lt;br /&gt;
{{ICCode|&lt;br /&gt;
move r0 12345&lt;br /&gt;
move r1 123.456&lt;br /&gt;
move r2 $E1B2&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Indirect referencing==&lt;br /&gt;
This is a way of accessing a register by using another register as a pointer. Adding an additional r in front of the register turns on this behaviour. The value stored in the register being used as the pointer must be between 0 to 15, this will then point to a register from r0 to r15, higher or lower values will cause an error.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
move r0 5 # stores the value 5 in r0&lt;br /&gt;
move rr0 10 &lt;br /&gt;
# is now the same as &#039;move r5 10&#039; &lt;br /&gt;
# since r0 has the value 5, rr0 points at the register r5&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Additional r&#039;s can be added to do indirect referencing multiple times in a row.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
move r1 2&lt;br /&gt;
move r2 3&lt;br /&gt;
move rrr1 4&lt;br /&gt;
# is now the same as &#039;move r3 4&#039;&lt;br /&gt;
# since r1 points at r2 which points at r3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This also works with devices&lt;br /&gt;
{{ICCode|&lt;br /&gt;
move r0 2 # stores the value 2 in r0&lt;br /&gt;
s dr0 On 1 &lt;br /&gt;
# is now the same as &#039;s d2 On 1&#039;&lt;br /&gt;
# r0 has the value 2 so dr0 points at d2&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Dynamically changing LogicType when interacting with Device Registers ==&lt;br /&gt;
When the &amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt; instructions are used to read from or write to a Device Register, the LogicType is the variable that will be interacted with (example: in &amp;lt;code&amp;gt;l r0 myDevice Temperature&amp;lt;/code&amp;gt; the LogicType is the Temperature). In most scripts the LogicType will be hardcoded. But it&#039;s also possible to change the LogicType dynamically. The LogicType is an enum, where each type is identified by a unique integer value. This makes it possible to cycle through them in various ways, either as a list placed on the Stack, or by increasing the LogicType value via addition in each loop.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
#loop through a list of LogicTypes&lt;br /&gt;
push LogicType.RatioOxygen&lt;br /&gt;
push LogicType.RatioVolatiles&lt;br /&gt;
push LogicType.Temperature&lt;br /&gt;
loop:&lt;br /&gt;
pop r1&lt;br /&gt;
l r0 myDevice r1&lt;br /&gt;
...&lt;br /&gt;
bgtz sp loop #loop until the Stack is empty}}&lt;br /&gt;
&lt;br /&gt;
==Network Referencing / Channels==&lt;br /&gt;
&lt;br /&gt;
All cable networks have 8 Channels which can have data loaded from/stored to via a device and connection reference. Connections for each supported device are listed in the stationpedia. All &#039;connections&#039; a device can make are a connection (pipe, chute, cable), but only cable networks have channels.&lt;br /&gt;
&lt;br /&gt;
The 8 channels (Channel0 to Channel7) are however volatile, in that data is destroyed if any part of the cable network is changed, removed, or added to, and also whenever the world is exited. All these channels default to NaN. Strictly speaking, they default to what we would call &amp;quot;quiet NaN&amp;quot;, in that its not an error it simply means its not a number yet. Recommend you use these channels for reading and writing between networks, rather than as a data store. This effectively means an IC can read all the networks for all devices to connected to it, so not just their own local network, but any networks any device they can reference is connected to.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
# d0 is device zero, and the :0 refers&lt;br /&gt;
# to that device&#039;s 0 connection&lt;br /&gt;
l r0 d0:0 Channel0}}&lt;br /&gt;
&lt;br /&gt;
For example: on an IC Housing, the 0 connection is the data port and 1 is power, so you could write out r0 to Channel0 of the power network of the Housing using &amp;lt;code&amp;gt;s db:1 Channel0 r0&amp;lt;/code&amp;gt;&lt;br /&gt;
{{ICCode|&lt;br /&gt;
#read all 8 channels with a loop and&lt;br /&gt;
#place the values in r0 to r7&lt;br /&gt;
move r15 LogicType.Channel0 #LogicType integer&lt;br /&gt;
move r14 0 #pointer for indirect referencing&lt;br /&gt;
loop:&lt;br /&gt;
l rr14 db:0 r15&lt;br /&gt;
add r15 r15 1 #next channel&lt;br /&gt;
add r14 r14 1 #next register&lt;br /&gt;
ble r15 LogicType.Channel7 loop&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Logic gates, Bitwise and Logical==&lt;br /&gt;
&lt;br /&gt;
All logic gates in MIPS have a bitwise behavior. The available gates are NOT, AND, OR, XOR and NOR (XNOR and NAND are missing).&lt;br /&gt;
&lt;br /&gt;
In Bitwise operations, each bit is matched separately, which includes the sign bit.&lt;br /&gt;
&lt;br /&gt;
To understand what is going on with bitwise operations, a little bit of computer theory is needed. In Stationeers each register uses 64 bits for integer values (a number without decimals), where the 64th bit is the sign-bit (0 for positive and 1 for negative). Since the number 0 is counted as a positive value, this gives each register a range of (2^63 - 1) to -2^63. Negative numbers also behave according to Two&#039;s complement (https://en.wikipedia.org/wiki/Two%27s_complement). Which means that a number with a sign-bit of 1 will have all of its number bits flipped as well, so that the decimal value of -1 is represented by a binary value of sixtyfour 1&#039;s (this is the smallest possible negative integer since zero counts as a positive integer).&lt;br /&gt;
&lt;br /&gt;
MIPS have binary notation (https://en.wikipedia.org/wiki/Binary_number) that is activated by placing a % in front of the number. The _ characters are ignored and only used for readability.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;not r0 0&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# 0 = %00000000_00000000_00000000_00000000_00000000_00000000_00000000_00000000&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# flip all bits&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# -1 = %11111111_11111111_11111111_11111111_11111111_11111111_11111111_11111111&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# r0 equals -1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;and r0 3 6&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# 3 = %011&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# 6 = %110&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# only the bits in the &amp;quot;2&amp;quot; position are matching&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# r0 equals %010 = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operations can still be performed via alternative instructions. But these are not perfect substitutes, they treat negative values differently, and some can produce non-binary outputs. When using these, keep in mind that devices that wants a binary value will treat any non-binary values like this: &amp;gt;= 1 counts as &amp;quot;1&amp;quot; and &amp;lt;1 counts as &amp;quot;0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# r0 = result&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# r1 = input A&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# r2 = input B&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Logical NOT = seqz r0 r1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Logical AND = min r0 r1 r2&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Logical OR = max r0 r1 r2&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Logical XOR = sne r0 r1 r2 (only for binary inputs)&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Logical NAND = not and&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Logical NOR = not or&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Logical XNOR = not xor&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging advices==&lt;br /&gt;
The value stored in a register or variable can easily be displayed by writing it to the Setting parameter of the IC housing. This has no side effects. To see the value, just stand close to the IC housing and look directly at the housing.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;s db Setting r0&amp;lt;/code&amp;gt;. # sets/writes the value of register &#039;&#039;&#039;r0&#039;&#039;&#039; into the parameter &#039;&#039;&#039;Setting&#039;&#039;&#039; of the IC Housing(&#039;&#039;&#039;db&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
To check if a certain block of code is executed, use the above trick but with a random number that you choose, like the line number.&amp;lt;br&amp;gt; This example will display the number 137 on the IC housing.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;s db Setting 137&amp;lt;/code&amp;gt;  # sets/writes the number 137 into the parameter &#039;&#039;&#039;Setting&#039;&#039;&#039; of the IC Housing(&#039;&#039;&#039;db&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
Always use unique names for labels. When a label is named after a IC10 keyword like &amp;quot;Temperature:&amp;quot; or &amp;quot;Setting:&amp;quot; the original meaning of the keyword is overwritten, so when an instruction tries to use it an error will occur.&lt;br /&gt;
&lt;br /&gt;
A [[Cartridge#Configuration|configuration cartridge]] installed in a [[Handheld_Tablet|tablet]]  can be used to see all available values and configuration parameter for all devices you focus on.&lt;br /&gt;
&lt;br /&gt;
==Learning IC10==&lt;br /&gt;
IC10 can be difficult to get started with. So here is a list of instructions that are useful for beginners. These can be used to write many different scripts.&lt;br /&gt;
&lt;br /&gt;
General:&lt;br /&gt;
* &amp;lt;code&amp;gt;alias&amp;lt;/code&amp;gt; make the script easier to read by assigning a name to a register or device, example: &amp;lt;code&amp;gt;alias rTemperature r15&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;label:&amp;lt;/code&amp;gt; where &amp;quot;label&amp;quot; can be replaced with almost any word, jump and branch instructions can use these in place of line numbers, example: &amp;lt;code&amp;gt;start:&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;yield&amp;lt;/code&amp;gt; pause for 1-tick and then resume, if not used the script will automatically pause for 1-tick after 128 lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Jumps:&lt;br /&gt;
*&amp;lt;code&amp;gt;j someLabelName&amp;lt;/code&amp;gt; jump to line with &#039;&#039;&#039;someLabelName&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;code&amp;gt;jal someLabelName&amp;lt;/code&amp;gt; stores the next line number into the register ra (return address) and then jump to &#039;&#039;&#039;someLabelName&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;code&amp;gt;j ra&amp;lt;/code&amp;gt; jump to register ra (return address)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Branching (jump-if):&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;beq a(r?|num) b(r?|num) c(r?|num)&amp;lt;/code&amp;gt; if &#039;&#039;&#039;a&#039;&#039;&#039; is equal to &#039;&#039;&#039;b&#039;&#039;&#039; goto &#039;&#039;&#039;c&#039;&#039;&#039;  (label or linenumber) &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;bne a(r?|num) b(r?|num) c(r?|num)&amp;lt;/code&amp;gt; if  &#039;&#039;&#039;a&#039;&#039;&#039; not-equal &#039;&#039;&#039;b&#039;&#039;&#039; goto  &#039;&#039;&#039;c&#039;&#039;&#039; (label or linenumber) &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;bgt a(r?|num) b(r?|num) c(r?|num)&amp;lt;/code&amp;gt; if  &#039;&#039;&#039;a&#039;&#039;&#039; greater than &#039;&#039;&#039;b&#039;&#039;&#039; goto   &#039;&#039;&#039;c&#039;&#039;&#039; (label or linenumber) &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;blt a(r?|num) b(r?|num) c(r?|num)&amp;lt;/code&amp;gt; if  &#039;&#039;&#039;a&#039;&#039;&#039; less than &#039;&#039;&#039;b&#039;&#039;&#039; goto &#039;&#039;&#039;c&#039;&#039;&#039; (label or linenumber) &amp;lt;br&amp;gt;&lt;br /&gt;
The suffix -al can be added to each of these (example: beqal) to save the &#039;&#039;&#039;next&#039;&#039;&#039; line number into the &amp;quot;return address&amp;quot; register. this is called using &amp;lt;code&amp;gt;j ra&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Device interactions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
l (load)&lt;br /&gt;
lb (load batch, requires one of the following: 0(Average) / 1(Sum) / 2(Minimum) / 3(Maximum))&lt;br /&gt;
ls (load slot)&lt;br /&gt;
s (store)&lt;br /&gt;
sb (store batch)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Logic and Math:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seqz (common NOT-gate: turns 0 into 1, and all other values into 0)&lt;br /&gt;
move&lt;br /&gt;
add (addition)&lt;br /&gt;
sub (subtraction)&lt;br /&gt;
mul (multiplication)&lt;br /&gt;
div (division)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Common device variables:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
On (1 is on, 0 is off)&lt;br /&gt;
Open (1 is open, 0 is closed)&lt;br /&gt;
Setting (meaning varies between devices, example: a LED display(console) will show this value)&lt;br /&gt;
Activate (1 usually means running, example: a Daylight sensor is 1 when the sun shines on it)&lt;br /&gt;
Temperature (in Kelvin, Celsius - 273.15)&lt;br /&gt;
Pressure (in kPa)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
&amp;lt;br&amp;gt;-All instructions and variables can be seen in-game in the IC editor window by clicking the &amp;quot;f&amp;quot;, &amp;quot;x&amp;quot; and &amp;quot;s(x)&amp;quot; buttons on the top right.&lt;br /&gt;
&amp;lt;br&amp;gt;-The stationpedia is the best source to see which variables are available to each device.&lt;br /&gt;
&amp;lt;br&amp;gt;-Most scripts are loops, they end with a jump instruction that leads back up to the start. Otherwise they will just run once and then stop.&lt;br /&gt;
&lt;br /&gt;
Two practice scripts:&lt;br /&gt;
&amp;lt;br&amp;gt;Automatic Night Light: Load &amp;quot;Activate&amp;quot; from a Daylight sensor, flip the value with a NOT-gate, store the value to the &amp;quot;On&amp;quot; variable of one or more lights.&lt;br /&gt;
&amp;lt;br&amp;gt;Automatic Wall Cooler: Read &amp;quot;Temperature&amp;quot; from a Gas Sensor. Branch if the value is greater than X, turn on the cooler. Branch if the value is less than Y, turn off the cooler. (Wall coolers need a minimum of 12.5 kPa pressure in the connected pipe)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Accessing devices via batch or ReferenceId ==&lt;br /&gt;
&lt;br /&gt;
The IC housing has 6 pins you can use to configure the devices it&lt;br /&gt;
uses.  This provides flexibility to let the installer configure which&lt;br /&gt;
devices will be controlled by the IC.&lt;br /&gt;
&lt;br /&gt;
Alternatives for accessing devices include the batch load/store and&lt;br /&gt;
the ReferenceId load/store instructions.&lt;br /&gt;
&lt;br /&gt;
{{ICCode|&lt;br /&gt;
# get the average charge ratio across station batteries&lt;br /&gt;
lb r0 HASH(&amp;quot;StructureBattery&amp;quot;) Ratio Average&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{ICCode|&lt;br /&gt;
# get the ReferenceId for the sorter named &amp;quot;Sorter Corn&amp;quot;&lt;br /&gt;
lbn r1 HASH(&amp;quot;StructureLogicSorter&amp;quot;) HASH(&amp;quot;Sorter Corn&amp;quot;) ReferenceId Maximum&lt;br /&gt;
ble r1 ninf ra&lt;br /&gt;
#use the ReferenceId to set that sorter&#039;s mode.&lt;br /&gt;
sd r1 Mode 1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Using the 6 configuration pins makes it easy to write reusable MIPS&lt;br /&gt;
scripts where the installer uses the pins to select the devices that&lt;br /&gt;
will be managed.&lt;br /&gt;
&lt;br /&gt;
Using batch-name instructions frees you from the hassle of adjusting&lt;br /&gt;
the pins, but requires you to name the devices via the [[Labeller]].  It&lt;br /&gt;
can also allow you to control more than 6 devices.&lt;br /&gt;
&lt;br /&gt;
=== Batch instructions ===&lt;br /&gt;
&lt;br /&gt;
The batch instructions can address multiple devices only via their &#039;&#039;&#039;PrefabHash&#039;&#039;&#039; generated from the prefab name using the `HASH(&amp;quot;Name&amp;quot;)` macro or copied directly from the [[Stationpedia]]. A prefab hash is always an integer. All devices that can be read with logic contain the logic value &#039;&#039;&#039;PrefabHash&#039;&#039;&#039; and &#039;&#039;&#039;NameHash&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
See [[#Slot.2FLogic_.2F_Batched|Batched instructions]] for a comprehensive list of all batch instructions.&lt;br /&gt;
&lt;br /&gt;
[[#sb|sb]], [[#sbn|sbn]], [[#sbs|sbs]], (no sbns)&amp;lt;br&amp;gt;&lt;br /&gt;
[[#lb|lb]], [[#lbs|lbs]], [[#lbn|lbn]], [[#lbns|lbns]]&lt;br /&gt;
&lt;br /&gt;
=== Direct reference instructions ===&lt;br /&gt;
&lt;br /&gt;
Direct reference instructions can address a specific device via its &#039;&#039;&#039;ReferenceId&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[#clrd|clrd]], [[#getd|getd]], [[#putd|putd]],&amp;lt;br&amp;gt;&lt;br /&gt;
[[#ld|ld]], [[#sd|sd]], (no slot access via reference ID)&lt;br /&gt;
&lt;br /&gt;
=Instructions=&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
See [[IC10/instructions]]&lt;br /&gt;
&lt;br /&gt;
{{:IC10/instructions}}&lt;br /&gt;
&lt;br /&gt;
[https://www.cs.tufts.edu/comp/140/lectures/Day_3/mips_summary.pdf Other examples]&lt;br /&gt;
&lt;br /&gt;
== Conditional functions cheatsheet ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! suffix !! description !! branch to line !! branch and store return address !! relative jump to line !! set register&lt;br /&gt;
|-&lt;br /&gt;
| prefix: ||  || b- || b-al || br- || s-&lt;br /&gt;
|-&lt;br /&gt;
|  || unconditional || j    || jal    || jr    || &lt;br /&gt;
|-&lt;br /&gt;
| -eq  || if a == b || beq  || beqal  || breq  || seq&lt;br /&gt;
|-&lt;br /&gt;
| -eqz || if a == 0 || beqz || beqzal || breqz || seqz&lt;br /&gt;
|-&lt;br /&gt;
| -ge  || if a &amp;gt;= b || bge  || bgeal  || brge  || sge&lt;br /&gt;
|-&lt;br /&gt;
| -gez || if a &amp;gt;= 0 || bgez || bgezal || brgez || sgez&lt;br /&gt;
|-&lt;br /&gt;
| -gt  || if a &amp;gt; b  || bgt  || bgtal  || brgt  || sgt&lt;br /&gt;
|-&lt;br /&gt;
| -gtz || if a &amp;gt; 0  || bgtz || bgtzal || brgtz || sgtz&lt;br /&gt;
|-&lt;br /&gt;
| -le  || if a &amp;lt;= b || ble  || bleal  || brle  || sle&lt;br /&gt;
|-&lt;br /&gt;
| -lez || if a &amp;lt;= 0 || blez || blezal || brlez || slez&lt;br /&gt;
|-&lt;br /&gt;
| -lt  || if a &amp;lt; b  || blt  || bltal  || brlt  || slt&lt;br /&gt;
|-&lt;br /&gt;
| -ltz || if a &amp;lt; 0  || bltz || bltzal || brltz || sltz&lt;br /&gt;
|-&lt;br /&gt;
| -ne  || if a != b || bne  || bneal  || brne  || sne&lt;br /&gt;
|-&lt;br /&gt;
| -nez || if a != 0 || bnez || bnezal || brnez || snez&lt;br /&gt;
|-&lt;br /&gt;
| -nan || if a == NaN || bnan ||  || brnan || snan&lt;br /&gt;
|-&lt;br /&gt;
| -nanz || if a != NaN ||  ||  || || snanz&lt;br /&gt;
|-&lt;br /&gt;
| -dns || if device d is not set          || bdns || bdnsal || brdns || sdns&lt;br /&gt;
|-&lt;br /&gt;
| -dse || if device d is set              || bdse || bdseal || brdse || sdse&lt;br /&gt;
|-&lt;br /&gt;
| -ap  || if a approximately equals b     || bap  || bapal  || brap  || sap&lt;br /&gt;
|-&lt;br /&gt;
| -apz || if a approximately equals 0     || bapz || bapzal || brapz || sapz&lt;br /&gt;
|-&lt;br /&gt;
| -na  || if a not approximately equals b || bna  || bnaal  || brna  || sna&lt;br /&gt;
|-&lt;br /&gt;
| -naz || if a not approximately equals 0 || bnaz || bnazal || brnaz || snaz&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All &amp;lt;code&amp;gt;b-&amp;lt;/code&amp;gt; commands require target line as last argument, all &amp;lt;code&amp;gt;s-&amp;lt;/code&amp;gt; commands require register to store result as first argument. All &amp;lt;code&amp;gt;br-&amp;lt;/code&amp;gt; commands require number to jump relatively as last argument. e.g. &amp;lt;code&amp;gt;breq a b 3&amp;lt;/code&amp;gt; means if a=b then jump to 3 lines after.&lt;br /&gt;
&lt;br /&gt;
All approximate functions require additional argument denoting how close two numbers need to be considered equal. E.g.: &amp;lt;code&amp;gt;sap r0 100 101 0.01&amp;lt;/code&amp;gt; will consider 100 and 101 almost equal (not more than 1%=0.01 different) and will set r0 to 1. The exact formula is &amp;lt;code&amp;gt;if abs(a - b) &amp;lt;= max(c * max(abs(a), abs(b)), float.epsilon * 8)&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;-ap&amp;lt;/code&amp;gt; and is similar for other approximate functions.&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Machine_epsilon&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039;&lt;br /&gt;
  FLT_EPSILON = 2^(−23) ≈ 1.19e−07;        &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;float (32 bit)&amp;lt;/span&amp;gt;&lt;br /&gt;
  DBL_EPSILON = 2^(−52) ≈ 2.20e−16;        &amp;lt;span style=&amp;quot;color:#4c9700;&amp;quot;&amp;gt;double (64 bit)&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;lt;code&amp;gt;if abs(100 - 101) &amp;lt;= max(0.01 * max(abs(100), abs(101)), float.epsilon * 8)&amp;lt;/code&amp;gt;&lt;br /&gt;
  &amp;lt;code&amp;gt;if abs(-1) &amp;lt;= max(0.01 * 101, float.epsilon * 8)&amp;lt;/code&amp;gt;&lt;br /&gt;
  &amp;lt;code&amp;gt;if 1 &amp;lt;= max(0.01 * 101, float.epsilon * 8)&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;if 1 &amp;lt;= max(1.01, FLT_EPSILON * 8)&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:#4c9700;&amp;quot;&amp;gt;if 1 &amp;lt;= max(1.01, DBL_EPSILON * 8)&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;if 1 &amp;lt;= max(1.01, 1.19e−07 * 8)&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:#4c9700;&amp;quot;&amp;gt;if 1 &amp;lt;= max(1.01, 2.20e−16 * 8)&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;if 1 &amp;lt;= max(1.01, 0.000000952)&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:#4c9700;&amp;quot;&amp;gt;if 1 &amp;lt;= max(1.01, 0.00000000000000176)&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;if 1 &amp;lt;= 1.01   TRUE   1&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:#4c9700;&amp;quot;&amp;gt;if 1 &amp;lt;= 1.01   TRUE   1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Device Variables==&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Activate&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Activate&lt;br /&gt;
:1 if device is activated (usually means running), otherwise 0&lt;br /&gt;
:&amp;lt;code&amp;gt;l r0 d0 Activate # sets r0 to 1 if on or 0 if off&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;AirRelease&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;AirRelease&lt;br /&gt;
&amp;lt;div id=&amp;quot;Charge&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Charge&lt;br /&gt;
:    The current charge the device has.&lt;br /&gt;
&amp;lt;div id=&amp;quot;CLearMemory&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ClearMemory&lt;br /&gt;
:    When set to 1, clears the counter memory (e.g. ExportCount).  Will set itself back to 0 when triggered.&lt;br /&gt;
&amp;lt;div id=&amp;quot;Color&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Color&lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#212AA5;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;0 (or lower) = Blue&lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#7B7B7B;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;1 = Grey &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#3F9B39;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;2 = Green &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#FF662B;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;3 = Orange &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#E70200;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;4 = Red &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#FFBC1B;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;5 = Yellow &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#E7E7E7;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;6 = White &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#080908;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;7 = Black &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#633C2B;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;8 = Brown &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#63633F;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;9 = Khaki &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#E41C99;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;10 = Pink &lt;br /&gt;
:    &amp;lt;div style=&amp;quot;display: inline-block; vertical-align: top; height: 20px; width: 20px; border: 1px solid black; margin-right: 5px; background-color:#732CA7;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;nbsp;11 (or higher) = Purple &lt;br /&gt;
&amp;lt;div id=&amp;quot;CompletionRatio&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;CompletionRatio&lt;br /&gt;
&amp;lt;div id=&amp;quot;ElevatorLevel&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ElevatorLevel&lt;br /&gt;
&amp;lt;div id=&amp;quot;ElevatorSpeed&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ElevatorSpeed&lt;br /&gt;
&amp;lt;div id=&amp;quot;Error&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Error&lt;br /&gt;
:	1 if device is in error state, otherwise 0&lt;br /&gt;
&amp;lt;div id=&amp;quot;ExportCount&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ExportCount&lt;br /&gt;
:    How many items exporfted since last ClearMemory.&lt;br /&gt;
&amp;lt;div id=&amp;quot;Filtration&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Filtration&lt;br /&gt;
:	The current state of the filtration system.  For example filtration = 1 for a Hardsuit when filtration is On.&lt;br /&gt;
&amp;lt;div id=&amp;quot;Harvest&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Harvest&lt;br /&gt;
:	Performs the harvesting action for any plant based machinery.&lt;br /&gt;
:  &amp;lt;code&amp;gt;s d0 Harvest 1 # Performs 1 harvest action on device d0&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;Horizontal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Horizontal&lt;br /&gt;
&amp;lt;div id=&amp;quot;HorizontalRatio&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;HorizontalRatio&lt;br /&gt;
&amp;lt;div id=&amp;quot;Idle&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Idle&lt;br /&gt;
&amp;lt;div id=&amp;quot;ImportCount&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ImportCount&lt;br /&gt;
&amp;lt;div id=&amp;quot;Lock&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Lock&lt;br /&gt;
&amp;lt;div id=&amp;quot;Maximum&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Maximum&lt;br /&gt;
&amp;lt;div id=&amp;quot;Mode&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Mode&lt;br /&gt;
&amp;lt;div id=&amp;quot;On&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;On&lt;br /&gt;
&amp;lt;div id=&amp;quot;Open&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Open&lt;br /&gt;
&amp;lt;div id=&amp;quot;Output&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Output&lt;br /&gt;
&amp;lt;div id=&amp;quot;Plant&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Plant&lt;br /&gt;
:    Performs the planting operation for any plant based machinery.&lt;br /&gt;
:  &amp;lt;code&amp;gt;s d0 Plant 1 # Plants one crop in device d0&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;PositionX&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PositionX&lt;br /&gt;
&amp;lt;div id=&amp;quot;PositionY&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PositionY&lt;br /&gt;
&amp;lt;div id=&amp;quot;PositionZ&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PositionZ&lt;br /&gt;
&amp;lt;div id=&amp;quot;Power&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Power&lt;br /&gt;
&amp;lt;div id=&amp;quot;PowerActual&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PowerActual&lt;br /&gt;
&amp;lt;div id=&amp;quot;PowerPotential&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PowerPotential&lt;br /&gt;
&amp;lt;div id=&amp;quot;PowerRequired&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PowerRequired&lt;br /&gt;
&amp;lt;div id=&amp;quot;Pressure&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Pressure&lt;br /&gt;
&amp;lt;div id=&amp;quot;PressureExternal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PressureExternal&lt;br /&gt;
&amp;lt;div id=&amp;quot;PressureInteral&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PressureInteral&lt;br /&gt;
&amp;lt;div id=&amp;quot;PressureSetting&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PressureSetting&lt;br /&gt;
&amp;lt;div id=&amp;quot;Quantity&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Quantity&lt;br /&gt;
:	Total quantity in the device.&lt;br /&gt;
&amp;lt;div id=&amp;quot;Ratio&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Ratio&lt;br /&gt;
:	Context specific value depending on device, 0 to 1 based ratio.&lt;br /&gt;
&amp;lt;div id=&amp;quot;RatioCarbonDioxide&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RatioCarbonDioxide&lt;br /&gt;
&amp;lt;div id=&amp;quot;RatioNitrogen&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RatioNitrogen&lt;br /&gt;
:	The ratio of nitrogen in device atmosphere.&lt;br /&gt;
&amp;lt;div id=&amp;quot;RatioOxygen&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RatioOxygen&lt;br /&gt;
:	The ratio of oxygen in device atmosphere.&lt;br /&gt;
&amp;lt;div id=&amp;quot;RatioPollutant&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RatioPollutant&lt;br /&gt;
:	The ratio of pollutant in device atmosphere.&lt;br /&gt;
&amp;lt;div id=&amp;quot;RatioVolatiles&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RatioVolatiles&lt;br /&gt;
:	The ratio of volatiles in device atmosphere.&lt;br /&gt;
&amp;lt;div id=&amp;quot;RatioWater&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RatioWater&lt;br /&gt;
:	The ratio of water in device atmosphere.&lt;br /&gt;
&amp;lt;div id=&amp;quot;Reagents&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Reagents&lt;br /&gt;
&amp;lt;div id=&amp;quot;RecipeHash&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RecipeHash&lt;br /&gt;
&amp;lt;div id=&amp;quot;RequestHash&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ReferenceId&lt;br /&gt;
:    Unique Identifier of a Device, this value is different for every device in a save.&lt;br /&gt;
&amp;lt;div id=&amp;quot;ReferenceId&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RequestHash&lt;br /&gt;
&amp;lt;div id=&amp;quot;RequiredPower&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;RequiredPower&lt;br /&gt;
&amp;lt;div id=&amp;quot;Setting&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Setting&lt;br /&gt;
&amp;lt;div id=&amp;quot;SolarAngle&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;SolarAngle&lt;br /&gt;
:    Solar angle of the device.&lt;br /&gt;
:  &amp;lt;code&amp;gt;l r0 d0 SolarAngle # Sets r0 to the solar angle of d0.&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;Temperature&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Temperature&lt;br /&gt;
&amp;lt;div id=&amp;quot;TemperatureSettings&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;TemperatureSettings&lt;br /&gt;
&amp;lt;div id=&amp;quot;TotalMoles&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;TotalMoles&lt;br /&gt;
&amp;lt;div id=&amp;quot;VelocityMagnitude&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;VelocityMagnitude&lt;br /&gt;
&amp;lt;div id=&amp;quot;VelocityRelativeX&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;VelocityRelativeX&lt;br /&gt;
&amp;lt;div id=&amp;quot;VelocityRelativeY&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;VelocityRelativeY&lt;br /&gt;
&amp;lt;div id=&amp;quot;VelocityRelativeZ&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;VelocityRelativeZ&lt;br /&gt;
&amp;lt;div id=&amp;quot;Vertical&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Vertical&lt;br /&gt;
:	Vertical setting of the device.&lt;br /&gt;
&amp;lt;div id=&amp;quot;VerticalRatio&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;VerticalRatio&lt;br /&gt;
:	Ratio of vertical setting for device.&lt;br /&gt;
&amp;lt;div id=&amp;quot;Volume&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Volume&lt;br /&gt;
:	Returns the device atmosphere volume&lt;br /&gt;
&lt;br /&gt;
==Slot Variables==&lt;br /&gt;
In general (exceptions exist such as filtration units) slots are assigned as follows.&lt;br /&gt;
:Slot 0: Import&lt;br /&gt;
:Slot 1: Export&lt;br /&gt;
:Slot 2: Inside Machine&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Occupied&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Occupied&lt;br /&gt;
:&amp;lt;code&amp;gt;ls r0 d0 2 Occupied #Stores 1 in r0 if d0 has more seeds&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;ls vOccupied dThisVictim 2 Occupied #stores 1 in vOccupied if dThisVictim has more seeds&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;OccupantHash&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;OccupantHash&lt;br /&gt;
&amp;lt;div id=&amp;quot;Quantity&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Quantity&lt;br /&gt;
&amp;lt;div id=&amp;quot;Damage&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Damage&lt;br /&gt;
&amp;lt;div id=&amp;quot;Efficiency&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Efficiency&lt;br /&gt;
&amp;lt;div id=&amp;quot;Health&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Health&lt;br /&gt;
&amp;lt;div id=&amp;quot;Growth&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Growth&lt;br /&gt;
:&amp;lt;code&amp;gt;ls r0 d0 0 Growth # Store the numerical growth stage of d0 in r0&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;div id=&amp;quot;Pressure&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Pressure&lt;br /&gt;
&amp;lt;div id=&amp;quot;Temperature&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Temperature&lt;br /&gt;
&amp;lt;div id=&amp;quot;Charge&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Charge&lt;br /&gt;
&amp;lt;div id=&amp;quot;ChargeRatio&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;ChargeRatio&lt;br /&gt;
&amp;lt;div id=&amp;quot;Class&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Class&lt;br /&gt;
&amp;lt;div id=&amp;quot;PressureWaste&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PressureWaste&lt;br /&gt;
&amp;lt;div id=&amp;quot;PressureAir&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;PressureAir&lt;br /&gt;
&amp;lt;div id=&amp;quot;MaxQuantity&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;MaxQuantity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Mature&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;Mature&lt;br /&gt;
:&amp;lt;code&amp;gt;ls r0 d0 0 Mature # Store 1 in r0 if d0 has a mature crop&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;ls vMature dThisVictim 0 Mature # Store 1 in vMature if dThisVictim has a mature crop&amp;lt;/code&amp;gt;&lt;br /&gt;
;ReferenceId&lt;br /&gt;
:    Unique Identifier of a Device, this value is different for every device in a save.&lt;br /&gt;
&amp;lt;div id=&amp;quot;ReferenceId&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
Previous examples were obsolete due to game changes, or confusing, they have been moved into the Discussions section&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Harvie automation===&lt;br /&gt;
This script uses the batch instruction &amp;lt;code&amp;gt;sb ...&amp;lt;/code&amp;gt; to control all Harvie devices on the network. But only one Harvie and one Tray will be the &#039;&#039;master&#039;&#039; and have their values read, the rest of the Harvies will repeat exactly what this unit does. Some problems with this design is that different types of crops mature at different speeds, and if seeds were manually planted and the master unit recieved the first seed, the harvesting action will be performed too early on all the other plants since they are growing a few seconds slower.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; data-expandtext=&amp;quot;{{int:Expand, Automated Harvie Script}}&amp;quot; data-collapsetext=&amp;quot;{{int:Collapse, Automated Harvie Script}}&amp;quot;&amp;gt;&lt;br /&gt;
{{ICCode|&lt;br /&gt;
alias dHarvie d0&lt;br /&gt;
alias dTray d1&lt;br /&gt;
&lt;br /&gt;
alias rHarvieHash r8&lt;br /&gt;
alias rTrayHash r9&lt;br /&gt;
l rHarvieHash dHarvie PrefabHash&lt;br /&gt;
l rTrayHash dTray PrefabHash&lt;br /&gt;
&lt;br /&gt;
main:&lt;br /&gt;
yield&lt;br /&gt;
#read plant data from the Tray&lt;br /&gt;
ls r0 dTray 0 Mature&lt;br /&gt;
#harvestable plants return 1, young plants return 0&lt;br /&gt;
#nothing planted returns -1&lt;br /&gt;
beq r0 -1 plantCrop&lt;br /&gt;
beq r0 1 harvestCrop&lt;br /&gt;
ls r0 dTray 0 Seeding&lt;br /&gt;
#seeds available returns 1, all seeds picked returns 0&lt;br /&gt;
#plants too young or old for seeds returns -1&lt;br /&gt;
beq r0 1 harvestCrop&lt;br /&gt;
j main&lt;br /&gt;
&lt;br /&gt;
plantCrop:&lt;br /&gt;
#stop the planting if no seeds available&lt;br /&gt;
#otherwise it will plant nothing repeatedly&lt;br /&gt;
ls r0 dHarvie 0 Occupied&lt;br /&gt;
beq r0 0 main&lt;br /&gt;
sb rHarvieHash Plant 1&lt;br /&gt;
j main&lt;br /&gt;
&lt;br /&gt;
harvestCrop:&lt;br /&gt;
sb rHarvieHash Harvest 1&lt;br /&gt;
j main&lt;br /&gt;
&lt;br /&gt;
### End Script ###&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
===Solar Panel 2-axis tracking===&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; data-expandtext=&amp;quot;{{int:Expand, Solar Panel 2-axis tracking}}&amp;quot; data-collapsetext=&amp;quot;{{int:Collapse, Solar Panel 2-axis tracking}}&amp;quot;&amp;gt;&lt;br /&gt;
{{ICCode|&lt;br /&gt;
#2 Axis Solar Tracking adapted from CowsAreEvil.&lt;br /&gt;
#Place all panels in uniform manner.&lt;br /&gt;
#Set one to 15 Vertical(Min value). 0 Horizontal.&lt;br /&gt;
#Take note direction panel faces.&lt;br /&gt;
#Place daylight sensor flat pointing in the direction&lt;br /&gt;
#the panel now faces. (Cable port facing opposite)&lt;br /&gt;
&lt;br /&gt;
#Alias the sensor to d0&lt;br /&gt;
alias sensor d0&lt;br /&gt;
&lt;br /&gt;
# define the Panel variants&lt;br /&gt;
define Heavy -934345724&lt;br /&gt;
define HeavyDual -1545574413&lt;br /&gt;
define Solar -2045627372&lt;br /&gt;
define SolarDual -539224550&lt;br /&gt;
&lt;br /&gt;
start:&lt;br /&gt;
yield&lt;br /&gt;
#Check for daylight.&lt;br /&gt;
l r0 sensor Activate&lt;br /&gt;
beqz r0 reset&lt;br /&gt;
#Read the Horizontal data.&lt;br /&gt;
l r0 sensor Horizontal&lt;br /&gt;
#Set batch to the panels.&lt;br /&gt;
sb Heavy Horizontal r0&lt;br /&gt;
sb HeavyDual Horizontal r0&lt;br /&gt;
sb Solar Horizontal r0&lt;br /&gt;
sb SolarDual Horizontal r0&lt;br /&gt;
#Read the Vertical data and subtract 90&lt;br /&gt;
l r0 sensor Vertical&lt;br /&gt;
sub r0 90 r0&lt;br /&gt;
#Set batch to the panels.&lt;br /&gt;
sb Heavy Vertical r0&lt;br /&gt;
sb HeavyDual Vertical r0&lt;br /&gt;
sb Solar Vertical r0&lt;br /&gt;
sb SolarDual Vertical r0&lt;br /&gt;
j start&lt;br /&gt;
&lt;br /&gt;
reset:&lt;br /&gt;
yield&lt;br /&gt;
sb Heavy Horizontal 270 #Edit this to face sunrise.&lt;br /&gt;
sb HeavyDual Horizontal 270 #Edit this&lt;br /&gt;
sb Solar Horizontal 270 #Edit this&lt;br /&gt;
sb SolarDual Horizontal 270 #Edit this&lt;br /&gt;
sb Heavy Vertical 0&lt;br /&gt;
sb HeavyDual Vertical 0&lt;br /&gt;
sb Solar Vertical 0&lt;br /&gt;
sb SolarDual Vertical 0&lt;br /&gt;
sleep 10&lt;br /&gt;
j start&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
===IC10 Schmitt Trigger - Sensor Range Based Device Toggle===&lt;br /&gt;
This script demonstrates the IC10 style Schmitt Trigger Pattern in basic examples using the &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; instruction with its ternary condition to toggle a device &amp;lt;code&amp;gt;On&amp;lt;/code&amp;gt; state based on a range of sensor readings.  Examples for both styles are provided below, i.e. &#039;cooling&#039; or &#039;heating&#039;, for &#039;below min&#039; or &#039;greater than max&#039; style range-based toggle.  A temperature based control is shown in the examples, but any sensor reading could be used to dynamically toggle a device &amp;lt;code&amp;gt;On&amp;lt;/code&amp;gt; state such pressure, charge ratio, solar angle, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; data-expandtext=&amp;quot;{{int:Expand, IC10 Schmitt Trigger Pattern}}&amp;quot; data-collapsetext=&amp;quot;{{int:Collapse, IC10 Schmitt Trigger Pattern}}&amp;quot;&amp;gt;&lt;br /&gt;
{{ICCode|&lt;br /&gt;
# ---- IC10 Schmitt Trigger ----&lt;br /&gt;
# -- Standard - i.e. &amp;quot;cooling&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#When the temperature sensor device reports a value&lt;br /&gt;
# higher than TempMax and the valve is not On, the&lt;br /&gt;
# valve will turn On.&lt;br /&gt;
&lt;br /&gt;
#When the valve is On, and the sensor device reports&lt;br /&gt;
# higher than TempMin, the valve will remain on.&lt;br /&gt;
&lt;br /&gt;
#Once that sensor reports a temperature lower than&lt;br /&gt;
# TempMin, the valve will once again shut off and&lt;br /&gt;
# this cycle will continue indefinitely:&lt;br /&gt;
&lt;br /&gt;
define TempMax 296.15 #23C&lt;br /&gt;
define TempMin 283.15 #10C&lt;br /&gt;
&lt;br /&gt;
alias Valve d0&lt;br /&gt;
alias Sensor d1&lt;br /&gt;
&lt;br /&gt;
example1:&lt;br /&gt;
 yield&lt;br /&gt;
 l r0 Valve On&lt;br /&gt;
 select r0 r0 TempMin TempMax&lt;br /&gt;
 l r1 Sensor Temperature&lt;br /&gt;
 sgt r0 r1 r0&lt;br /&gt;
 s Valve On r0&lt;br /&gt;
j example1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ---- IC10 Schmitt Trigger ----&lt;br /&gt;
# -- Inverted - i.e. &amp;quot;heating&amp;quot;&lt;br /&gt;
#When the temperature sensor device reports a value&lt;br /&gt;
# lower than TempMin and the valve is not On, the&lt;br /&gt;
# valve will turn On.&lt;br /&gt;
&lt;br /&gt;
#When the valve is On, and the sensor device reports&lt;br /&gt;
# lower than TempMax, the valve will remain on.&lt;br /&gt;
&lt;br /&gt;
#Once that sensor reports a temperature higher than&lt;br /&gt;
# TempMax, the valve will once again shut off and&lt;br /&gt;
# this cycle will continue indefinitely:&lt;br /&gt;
&lt;br /&gt;
define TempMax 296.15 #23C&lt;br /&gt;
define TempMin 283.15 #10C&lt;br /&gt;
&lt;br /&gt;
alias Valve d0&lt;br /&gt;
alias Sensor d1&lt;br /&gt;
&lt;br /&gt;
example2:&lt;br /&gt;
 yield&lt;br /&gt;
 l r0 Valve On&lt;br /&gt;
 select r0 r0 TempMax TempMin&lt;br /&gt;
 l r1 Sensor Temperature&lt;br /&gt;
 slt r0 r1 r0&lt;br /&gt;
 s Valve On r0&lt;br /&gt;
j example2&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
===Example experiment: how many lines of code are executed each tick?===&lt;br /&gt;
To determine this, a script without &amp;lt;code&amp;gt;yield&amp;lt;/code&amp;gt; will be used. It should have as few lines as possible (so no labels are used, but a reset value at the top will be needed) and count the number of lines, the IC Housing will be used to display the result.&lt;br /&gt;
{{ICCode|&lt;br /&gt;
move r0 1   #the first line has number 0&lt;br /&gt;
add r0 r0 3&lt;br /&gt;
s db Setting r0&lt;br /&gt;
j 1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Result (the numbers appears every 0.5 seconds):&lt;br /&gt;
&amp;lt;br&amp;gt;127&lt;br /&gt;
&amp;lt;br&amp;gt;256 (+129)&lt;br /&gt;
&amp;lt;br&amp;gt;385 (+129)&lt;br /&gt;
&amp;lt;br&amp;gt;511 (+126)&lt;br /&gt;
&amp;lt;br&amp;gt;640 (+129)&lt;br /&gt;
&amp;lt;br&amp;gt;769 (+129)&lt;br /&gt;
&amp;lt;br&amp;gt;895 (+126)&lt;br /&gt;
&amp;lt;br&amp;gt;1024 (+129)&lt;br /&gt;
&amp;lt;br&amp;gt;1153 (+129)&lt;br /&gt;
&lt;br /&gt;
There is a repeating +129, +129, +126 sequence, a hint that the real value is 128. Which also happens to be the number of lines in a script, which makes sense. A variation of this experiment will show that empty rows are also counted towards this number.&lt;br /&gt;
&lt;br /&gt;
===Push &amp;amp; Pop return address when calling multiple levels of functions===&lt;br /&gt;
More advanced scripts, or scripts that wish to be more generic, may want to allow calling more than one level of function. Allowing this requires pushing the current &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; register before calling the function, then popping &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; back afterward.&lt;br /&gt;
&lt;br /&gt;
For example, imagine that the main loop of the code wants to call function &amp;lt;code&amp;gt;orientPanelsToStar&amp;lt;/code&amp;gt;, which would calculate the panels&#039; orientations, then place them in &amp;lt;code&amp;gt;r0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;r1&amp;lt;/code&amp;gt;, and then in turn itself call &amp;lt;code&amp;gt;orientPanelsTo&amp;lt;/code&amp;gt;, which would set the orientations of all panels based on the precomputed values of &amp;lt;code&amp;gt;r0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;r1&amp;lt;/code&amp;gt;. Doing so requires &amp;lt;code&amp;gt;orientPanelsToStar&amp;lt;/code&amp;gt; to push &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; before calling &amp;lt;code&amp;gt;orientPanelsTo&amp;lt;/code&amp;gt;, as show in the code below.&lt;br /&gt;
&lt;br /&gt;
{{ICCode|&lt;br /&gt;
orientPanelsToStar:&lt;br /&gt;
# Save return address set by the &#039;jal&#039; instruction&lt;br /&gt;
push ra&lt;br /&gt;
&lt;br /&gt;
# ...Calculate panels&#039; orientation, for example leaving the results in r0 and r1...&lt;br /&gt;
&lt;br /&gt;
# Now call orientPanelsTo to actually set the panels&#039; orientation&lt;br /&gt;
# based on the computed values of r0 and r1.&lt;br /&gt;
jal orientPanelsTo&lt;br /&gt;
&lt;br /&gt;
# ...Call other functions here if desired...&lt;br /&gt;
&lt;br /&gt;
# Restore the return address of orientPanelsToStar itself&lt;br /&gt;
pop ra&lt;br /&gt;
# Return to caller&lt;br /&gt;
j ra&lt;br /&gt;
&lt;br /&gt;
##########&lt;br /&gt;
&lt;br /&gt;
orientPanelsTo:&lt;br /&gt;
# ...Actually set panels&#039; orientation...&lt;br /&gt;
&lt;br /&gt;
# Return to caller&lt;br /&gt;
j ra&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This code would behave incorrectly if &amp;lt;code&amp;gt;push ra&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop ra&amp;lt;/code&amp;gt; were not present: within &amp;lt;code&amp;gt;orientPanelsToStar&amp;lt;/code&amp;gt;, doing &amp;lt;code&amp;gt;jal orientPanelsTo&amp;lt;/code&amp;gt; would replace the current value of the &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; register, permanently erasing where &amp;lt;code&amp;gt;orientPanelsToStar&amp;lt;/code&amp;gt; itself should jump back to once done. Pushing and popping &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; effectively saves its value until we need it again.&lt;br /&gt;
&lt;br /&gt;
(A tempting but wrong approach to &#039;saving&#039; &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; would be to &amp;lt;code&amp;gt;move&amp;lt;/code&amp;gt; it within a different register (e.g. &amp;lt;code&amp;gt;r15&amp;lt;/code&amp;gt;) before calling &amp;lt;code&amp;gt;orientPanelsTo&amp;lt;/code&amp;gt;, however that only permits two levels of functions, since if &amp;lt;code&amp;gt;orientPanelsTo&amp;lt;/code&amp;gt; itself wants to call another function, it would not be able to use &amp;lt;code&amp;gt;r15&amp;lt;/code&amp;gt; to save its &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; register since &amp;lt;code&amp;gt;r15&amp;lt;/code&amp;gt; already saves &amp;lt;code&amp;gt;orientPanelsToStar&amp;lt;/code&amp;gt;&#039;s return address. Just pushing/popping &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt; fixes all issues, allowing for a ginormous maximum function call depth of 512!)&lt;br /&gt;
&lt;br /&gt;
As a last note, if the script will push/pop values like &amp;lt;code&amp;gt;ra&amp;lt;/code&amp;gt;, starting the script by clearing the stack (which where push/pop move the data to) by running &amp;lt;code&amp;gt;clr db&amp;lt;/code&amp;gt; is advisable, unless the IC10 chip is not inserted inside an IC Housing (e.g. inserted in the slot of an Air Conditioner), since &amp;lt;code&amp;gt;clr db&amp;lt;/code&amp;gt; will cause an error in this case. To do so, run &amp;lt;code&amp;gt;clr db&amp;lt;/code&amp;gt; before the script&#039;s main loop.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=Links=&lt;br /&gt;
----&lt;br /&gt;
* Stationeers online IC10 Emulators so you can develop your code without repeatedly dying in game&lt;br /&gt;
** [https://ic10.dev/] Stationeers Code Simulator&lt;br /&gt;
** [https://ic10emu.dev] Stationeers IC10 Editor &amp;amp; Emulator - A feature packed code editor for Stationeers IC10 code, paired with a robust debugger and emulator. Edit, test, and share code.&lt;br /&gt;
** [https://stationeering.com/tools/ic] Stationeering provides a simulation of the IC10 chip inside Stationeers. IDE with error checking, full visibility of stack and registers.&lt;br /&gt;
* [http://www.easy68k.com/] EASy68K is a 68000 Structured Assembly Language IDE.&lt;br /&gt;
* [https://marketplace.visualstudio.com/items?itemName=Traineratwot.stationeers-ic10] syntax highlighting for IC10 MIPS for Visual Studio Code (updated Feb 10th 2022)&lt;br /&gt;
* [https://pastebin.com/6Uw1KSRN] syntax highlighting for IC10 MIPS for KDE kwrite/kate text editor&lt;br /&gt;
* [https://drive.google.com/file/d/1yEsJ-u94OkuMQ8K6fY7Ja1HNpLcAdjo_/view] syntax highlighting for IC10 MIPS for Notepad++&lt;br /&gt;
* [https://drive.google.com/file/d/1Xrv5U0ZI5jDcPv7yX7EAAxaGk5hKP0xO/view?usp=sharing] syntax highlighting for IC10 MIPS for Notepad++ (updated: 11/08/2022)&lt;br /&gt;
* [https://pastebin.com/3kmGy0NN] syntax highlighting for IC10 MIPS for Notepad++ (updated: 23/03/2024)&lt;br /&gt;
* [https://github.com/SnorreSelmer/stationeers_ic10/blob/main/README.md] Repo with a lot of code examples&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=Index=&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|+Functions &lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
*[[#abs|abs]]&lt;br /&gt;
*[[#add|add]]&lt;br /&gt;
*[[#alias|alias]]&lt;br /&gt;
*[[#and|and]]&lt;br /&gt;
*[[#beq|beq]]&lt;br /&gt;
*[[#bgez|bgez]]&lt;br /&gt;
*[[#bgtz|bgtz]]&lt;br /&gt;
*[[#blez|blez]]&lt;br /&gt;
*[[#bltz|bltz]]&lt;br /&gt;
*[[#bne|bne]]&lt;br /&gt;
*[[#breq|breq]]&lt;br /&gt;
*[[#brgez|brgez]]&lt;br /&gt;
*[[#brgtz|brgtz]]&lt;br /&gt;
*[[#brlez|brlez]]&lt;br /&gt;
*[[#brltz|brltz]]&lt;br /&gt;
*[[#brne|brne]]&lt;br /&gt;
*[[#ceil|cell]]&lt;br /&gt;
*[[#div|div]]&lt;br /&gt;
*[[#exp|exp]]&lt;br /&gt;
*[[#floor|floor]]&lt;br /&gt;
*[[#j|j]]&lt;br /&gt;
*[[#jr|jr]]&lt;br /&gt;
*[[#l|l]]&lt;br /&gt;
*[[#log|log]]&lt;br /&gt;
*[[#ls|ls]]&lt;br /&gt;
*[[#max|max]]&lt;br /&gt;
*[[#min|min]]&lt;br /&gt;
*[[#mod|mod]]&lt;br /&gt;
*[[#move|move]]&lt;br /&gt;
*[[#mul|mul]]&lt;br /&gt;
*[[#nor|nor]]&lt;br /&gt;
*[[#or|or]]&lt;br /&gt;
*[[#rand|rand]]&lt;br /&gt;
*[[#round|round]]&lt;br /&gt;
*[[#s|s]]&lt;br /&gt;
*[[#slt|slt]]&lt;br /&gt;
*[[#sqrt|sqrt]]&lt;br /&gt;
*[[#sub|sub]]&lt;br /&gt;
*[[#trunc|trunc]]&lt;br /&gt;
*[[#xor|xor]]xor&lt;br /&gt;
*[[#yield|yield]]&lt;br /&gt;
*[[##|#]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|+Device Variables &lt;br /&gt;
&amp;lt;div  class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
*[[#Activate|Activate]]&lt;br /&gt;
*[[#AirRelease|AirRelease]]&lt;br /&gt;
*[[#Charge|Charge]]&lt;br /&gt;
*[[#CLearMemory|CLearMemory]]&lt;br /&gt;
*[[#Color|Color]]&lt;br /&gt;
*[[#CompletionRatio|CompletionRatio]]&lt;br /&gt;
*[[#ElevatorLevel|ElevatorLevel]]&lt;br /&gt;
*[[#ElevatorSpeed|ElevatorSpeed]]&lt;br /&gt;
*[[#Error|Error]]&lt;br /&gt;
*[[#ExportCount|ExportCount]]&lt;br /&gt;
*[[#Filtration|Filtration]]&lt;br /&gt;
*[[#Harvest|Harvest]]&lt;br /&gt;
*[[#Horizontal|Horizontal]]&lt;br /&gt;
*[[#HorizontalRatio|HorizontalRatio]]&lt;br /&gt;
*[[#Idle|Idle]]&lt;br /&gt;
*[[#ImportCount|ImportCount]]&lt;br /&gt;
*[[#Lock|Lock]]&lt;br /&gt;
*[[#Maximum|Maximum]]&lt;br /&gt;
*[[#Mode|Mode]]&lt;br /&gt;
*[[#On|On]]&lt;br /&gt;
*[[#Open|Open]]&lt;br /&gt;
*[[#Output|Output]]&lt;br /&gt;
*[[#Plant|Plant]]&lt;br /&gt;
*[[#PositionX|PositionX]]&lt;br /&gt;
*[[#PositionY|PositionY]]&lt;br /&gt;
*[[#PositionZ|PositionZ]]&lt;br /&gt;
*[[#Power|Power]]&lt;br /&gt;
*[[#PowerActual|PowerActual]]&lt;br /&gt;
*[[#PowerPotential|PowerPotential]]&lt;br /&gt;
*[[#PowerRequired|PowerRequired]]&lt;br /&gt;
*[[#Pressure|Pressure]]&lt;br /&gt;
*[[#PressureExternal|PressureExternal]]&lt;br /&gt;
*[[#PressureInteral|PressureInteral]]&lt;br /&gt;
*[[#PressureSetting|PressureSetting]]&lt;br /&gt;
*[[#Quantity|Quantity]]&lt;br /&gt;
*[[#Ratio|Ratio]]&lt;br /&gt;
*[[#RatioCarbonDioxide|RatioCarbonDioxide]]&lt;br /&gt;
*[[#RatioNitrogen|RatioNitrogen]]&lt;br /&gt;
*[[#RatioOxygen|RatioOxygen]]&lt;br /&gt;
*[[#RatioPollutant|RatioPollutant]]&lt;br /&gt;
*[[#RatioVolatiles|RatioVolatiles]]&lt;br /&gt;
*[[#RatioWater|RatioWater]]&lt;br /&gt;
*[[#Reagents|Reagents]]&lt;br /&gt;
*[[#RecipeHash|RecipeHash]]&lt;br /&gt;
*[[#RequestHash|RequestHash]]&lt;br /&gt;
*[[#RequiredPower|RequiredPower]]&lt;br /&gt;
*[[#Setting|Setting]]&lt;br /&gt;
*[[#SolarAngle|SolarAngle]]&lt;br /&gt;
*[[#Temperature|Temperature]]&lt;br /&gt;
*[[#TemperatureSettings|TemperatureSettings]]&lt;br /&gt;
*[[#TotalMoles|TotalMoles]]&lt;br /&gt;
*[[#VelocityMagnitude|VelocityMagnitude]]&lt;br /&gt;
*[[#VelocityRelativeX|VelocityRelativeX]]&lt;br /&gt;
*[[#VelocityRelativeY|VelocityRelativeY]]&lt;br /&gt;
*[[#VelocityRelativeZ|VelocityRelativeZ]]&lt;br /&gt;
*[[#Vertical|Vertical]]&lt;br /&gt;
*[[#VerticalRatio|VerticalRatio]]&lt;br /&gt;
*[[#Volume|Volume]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|+Slot Variables &lt;br /&gt;
&amp;lt;div  class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
*[[#Occupied|Occupied]]&lt;br /&gt;
*[[#OccupantHash|OccupantHash]]&lt;br /&gt;
*[[#Quantity|Quantity]]&lt;br /&gt;
*[[#Damage|Damage]]&lt;br /&gt;
*[[#Efficiency|Efficiency]]&lt;br /&gt;
*[[#Health|Health]]&lt;br /&gt;
*[[#Growth|Growth]]&lt;br /&gt;
*[[#Pressure|Pressure]]&lt;br /&gt;
*[[#Temperature|Temperature]]&lt;br /&gt;
*[[#Charge|Charge]]&lt;br /&gt;
*[[#ChargeRatio|ChargeRatio]]&lt;br /&gt;
*[[#Class|Class]]&lt;br /&gt;
*[[#PressureWaste|PressureWaste]]&lt;br /&gt;
*[[#PressureAir|PressureAir]]&lt;br /&gt;
*[[#MaxQuantity|MaxQuantity]]&lt;br /&gt;
*[[#Mature|Mature]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Datzu</name></author>
	</entry>
	<entry>
		<id>https://stationeers-wiki.com/index.php?title=Solar_Logic_Circuits_Guide&amp;diff=23514</id>
		<title>Solar Logic Circuits Guide</title>
		<link rel="alternate" type="text/html" href="https://stationeers-wiki.com/index.php?title=Solar_Logic_Circuits_Guide&amp;diff=23514"/>
		<updated>2025-09-20T13:30:51Z</updated>

		<summary type="html">&lt;p&gt;Datzu: Add degrees&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Tutorials]][[Category:Solar power]]&lt;br /&gt;
&amp;lt;languages /&amp;gt;&lt;br /&gt;
== Disclaimer ==&lt;br /&gt;
&lt;br /&gt;
Due to the frequency of game updates, all solutions are subject to change and may or may not be functional.&lt;br /&gt;
&lt;br /&gt;
The designs on this page are valid as of v0.2.5906.26015 (2025-09-16)&lt;br /&gt;
&lt;br /&gt;
While this specific Guide calls out the sensor being place in a specific direction (north - 0 degrees), it&#039;s not necessary to orient your sensors to a specific direction.&lt;br /&gt;
If you find your panels don&#039;t point at the sun, you can add either 0, 90, 180 or 270 to the horizontal until they point at the sun. This guide is an attempt &lt;br /&gt;
to simplify the setup by removing an extra math, and memory chip (6 chips instead of 8). &lt;br /&gt;
&lt;br /&gt;
== Geometry Of [[Solar Panel|Solar Panels]] and [[Sensors#Daylight Sensor|Daylight Sensors]] ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
daylight sensor horizontal.png|Geometry of values measured by daylight sensor in horizontal (yaw) mode&lt;br /&gt;
daylight sensor vertical.png|Geometry of values measured by daylight sensor in vertical (pitch) mode&lt;br /&gt;
solar panel yaw-Horizontal setting.png|Effect of setting horizontal rotation of a solar panel&lt;br /&gt;
solar-horiz-formulas.svg|Equations relating horizontal sensor measurements from various orientations to solar panel horizontal rotation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solar tracking using Logic Chips ==&lt;br /&gt;
&lt;br /&gt;
=== Six-chip dual-axis tracking ===&lt;br /&gt;
To get a &amp;quot;100%&amp;quot; accurate solar tracker on planets with an offset solar arc, you need to include the Horizontal component to the solar angle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What do you need:&#039;&#039;&#039;&lt;br /&gt;
* [[Kit (Logic I/O)]] x4&lt;br /&gt;
* [[Kit (Logic Processor)]]&lt;br /&gt;
* [[Kit (Logic Memory)]]&lt;br /&gt;
* [[Sensors|Kit (Sensor)]] &amp;gt; [[Sensors#Daylight Sensor|Daylight Sensor]]&lt;br /&gt;
&lt;br /&gt;
Place the Daylight Sensor facing up, &#039;&#039;&#039;with the Data Port facing north (0 degrees).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Horizontal&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;IN&#039;&#039;&#039; !! &#039;&#039;&#039;VAR&#039;&#039;&#039; !! &#039;&#039;&#039;OUT&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Reader || Horizontal Reader || Daylight Sensor || Horizontal || &lt;br /&gt;
|-&lt;br /&gt;
| Batch Writer || Horizontal Writer || Horizontal Reader || Horizontal || Solar Panel&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Vertical&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;IN&#039;&#039;&#039; !! &#039;&#039;&#039;VAR&#039;&#039;&#039; !! &#039;&#039;&#039;OUT&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Reader || Vertical Reader || Daylight Sensor || Vertical || &lt;br /&gt;
|-&lt;br /&gt;
| Batch Writer || Vertical Writer || Vertical Correction Math || Vertical || Solar Panel&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;Value&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Memory || Vertical Correction Memory || 90&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;IN 1&#039;&#039;&#039; !! &#039;&#039;&#039;IN 2&#039;&#039;&#039; !! &#039;&#039;&#039;OUT&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Math || Vertical Correction Math || Vertical Reader || Vertical Correction Memory || Add&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:2022-10-02 Two-axis solar tracking.png|Accurate two-axis solar tracking]]&lt;br /&gt;
&lt;br /&gt;
The panels should align themselves to the sun, you make sure to &#039;&#039;&#039;put the Power Port on the panels facing east (east - 90 degrees).&#039;&#039;&#039; If you&#039;ve already built the panels and logic with the Power Port facing west, swapping the direction of the sensor so that its Data Port faces south will allow the setup to work with no additional changes.&lt;br /&gt;
&lt;br /&gt;
== Solar tracking using Integrated Circuits ==&lt;br /&gt;
This is the most powerful way to track the sun, but the implementation might be a bit daunting at first.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What you need:&#039;&#039;&#039;&lt;br /&gt;
* [[Integrated Circuit (IC10)]]&lt;br /&gt;
* [[Kit (IC Housing)]]&lt;br /&gt;
* [[Sensors|Kit (Sensor)]] &amp;gt; [[Sensors#Daylight Sensor|Daylight Sensor]]&lt;br /&gt;
&lt;br /&gt;
And if you don&#039;t already have one set up:&lt;br /&gt;
* [[Kit (Computer)]]&lt;br /&gt;
* [[Motherboard (IC Editor)|IC Editor Motherboard]]&lt;br /&gt;
&lt;br /&gt;
Place the &#039;&#039;&#039;Daylight Sensor&#039;&#039;&#039; facing up, note which direction the Data Port is facing, and which direction the solar panel Power Port is facing. These two directions are needed in the code. The &#039;&#039;&#039;Daylight Sensor&#039;&#039;&#039; is connected to the &#039;&#039;&#039;d0&#039;&#039;&#039; screw, that&#039;s all you need.&lt;br /&gt;
&lt;br /&gt;
A simple code example can be found here: https://stationeering.com/tools/ic/_2FpmwojGnBq&amp;lt;br&amp;gt;&lt;br /&gt;
This code is considered &amp;quot;inefficient&amp;quot; since it&#039;s hard-coded to spam all types of solar panels, even if you don&#039;t have them.&lt;br /&gt;
&lt;br /&gt;
A better code example can be found here: https://stationeering.com/tools/ic/_2FpoBEcd3QK&amp;lt;br&amp;gt;&lt;br /&gt;
It targets the solar-panel types on &#039;&#039;&#039;d2&#039;&#039;&#039; and (optionally) &#039;&#039;&#039;d3&#039;&#039;&#039;, so it&#039;s less spammy. It also has an option for a display (&#039;&#039;&#039;Kit (Console)&#039;&#039;&#039;) on &#039;&#039;&#039;d1&#039;&#039;&#039; that shows the sum of power output from both types of panels&lt;/div&gt;</summary>
		<author><name>Datzu</name></author>
	</entry>
	<entry>
		<id>https://stationeers-wiki.com/index.php?title=Solar_Logic_Circuits_Guide&amp;diff=23513</id>
		<title>Solar Logic Circuits Guide</title>
		<link rel="alternate" type="text/html" href="https://stationeers-wiki.com/index.php?title=Solar_Logic_Circuits_Guide&amp;diff=23513"/>
		<updated>2025-09-20T13:29:24Z</updated>

		<summary type="html">&lt;p&gt;Datzu: Add new format to important words and fix some typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Tutorials]][[Category:Solar power]]&lt;br /&gt;
&amp;lt;languages /&amp;gt;&lt;br /&gt;
== Disclaimer ==&lt;br /&gt;
&lt;br /&gt;
Due to the frequency of game updates, all solutions are subject to change and may or may not be functional.&lt;br /&gt;
&lt;br /&gt;
The designs on this page are valid as of v0.2.5906.26015 (2025-09-16)&lt;br /&gt;
&lt;br /&gt;
While this specific Guide calls out the sensor being place in a specific direction (north - 0 degrees), it&#039;s not necessary to orient your sensors to a specific direction.&lt;br /&gt;
If you find your panels don&#039;t point at the sun, you can add either 0, 90, 180 or 270 to the horizontal until they point at the sun. This guide is an attempt &lt;br /&gt;
to simplify the setup by removing an extra math, and memory chip (6 chips instead of 8). &lt;br /&gt;
&lt;br /&gt;
== Geometry Of [[Solar Panel|Solar Panels]] and [[Sensors#Daylight Sensor|Daylight Sensors]] ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
daylight sensor horizontal.png|Geometry of values measured by daylight sensor in horizontal (yaw) mode&lt;br /&gt;
daylight sensor vertical.png|Geometry of values measured by daylight sensor in vertical (pitch) mode&lt;br /&gt;
solar panel yaw-Horizontal setting.png|Effect of setting horizontal rotation of a solar panel&lt;br /&gt;
solar-horiz-formulas.svg|Equations relating horizontal sensor measurements from various orientations to solar panel horizontal rotation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solar tracking using Logic Chips ==&lt;br /&gt;
&lt;br /&gt;
=== Six-chip dual-axis tracking ===&lt;br /&gt;
To get a &amp;quot;100%&amp;quot; accurate solar tracker on planets with an offset solar arc, you need to include the Horizontal component to the solar angle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What do you need:&#039;&#039;&#039;&lt;br /&gt;
* [[Kit (Logic I/O)]] x4&lt;br /&gt;
* [[Kit (Logic Processor)]]&lt;br /&gt;
* [[Kit (Logic Memory)]]&lt;br /&gt;
* [[Sensors|Kit (Sensor)]] &amp;gt; [[Sensors#Daylight Sensor|Daylight Sensor]]&lt;br /&gt;
&lt;br /&gt;
Place the Daylight Sensor facing up, &#039;&#039;&#039;with the Data Port facing north.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Horizontal&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;IN&#039;&#039;&#039; !! &#039;&#039;&#039;VAR&#039;&#039;&#039; !! &#039;&#039;&#039;OUT&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Reader || Horizontal Reader || Daylight Sensor || Horizontal || &lt;br /&gt;
|-&lt;br /&gt;
| Batch Writer || Horizontal Writer || Horizontal Reader || Horizontal || Solar Panel&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Vertical&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;IN&#039;&#039;&#039; !! &#039;&#039;&#039;VAR&#039;&#039;&#039; !! &#039;&#039;&#039;OUT&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Reader || Vertical Reader || Daylight Sensor || Vertical || &lt;br /&gt;
|-&lt;br /&gt;
| Batch Writer || Vertical Writer || Vertical Correction Math || Vertical || Solar Panel&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;Value&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Memory || Vertical Correction Memory || 90&lt;br /&gt;
|-&lt;br /&gt;
! &#039;&#039;&#039;Chip&#039;&#039;&#039; !! &#039;&#039;&#039;Chip label&#039;&#039;&#039; !! &#039;&#039;&#039;IN 1&#039;&#039;&#039; !! &#039;&#039;&#039;IN 2&#039;&#039;&#039; !! &#039;&#039;&#039;OUT&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Logic Math || Vertical Correction Math || Vertical Reader || Vertical Correction Memory || Add&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:2022-10-02 Two-axis solar tracking.png|Accurate two-axis solar tracking]]&lt;br /&gt;
&lt;br /&gt;
The panels should align themselves to the sun, you make sure to &#039;&#039;&#039;put the Power Port on the panels facing east (east - 90 degrees).&#039;&#039;&#039; If you&#039;ve already built the panels and logic with the Power Port facing west, swapping the direction of the sensor so that its Data Port faces south will allow the setup to work with no additional changes.&lt;br /&gt;
&lt;br /&gt;
== Solar tracking using Integrated Circuits ==&lt;br /&gt;
This is the most powerful way to track the sun, but the implementation might be a bit daunting at first.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What you need:&#039;&#039;&#039;&lt;br /&gt;
* [[Integrated Circuit (IC10)]]&lt;br /&gt;
* [[Kit (IC Housing)]]&lt;br /&gt;
* [[Sensors|Kit (Sensor)]] &amp;gt; [[Sensors#Daylight Sensor|Daylight Sensor]]&lt;br /&gt;
&lt;br /&gt;
And if you don&#039;t already have one set up:&lt;br /&gt;
* [[Kit (Computer)]]&lt;br /&gt;
* [[Motherboard (IC Editor)|IC Editor Motherboard]]&lt;br /&gt;
&lt;br /&gt;
Place the &#039;&#039;&#039;Daylight Sensor&#039;&#039;&#039; facing up, note which direction the Data Port is facing, and which direction the solar panel Power Port is facing. These two directions are needed in the code. The &#039;&#039;&#039;Daylight Sensor&#039;&#039;&#039; is connected to the &#039;&#039;&#039;d0&#039;&#039;&#039; screw, that&#039;s all you need.&lt;br /&gt;
&lt;br /&gt;
A simple code example can be found here: https://stationeering.com/tools/ic/_2FpmwojGnBq&amp;lt;br&amp;gt;&lt;br /&gt;
This code is considered &amp;quot;inefficient&amp;quot; since it&#039;s hard-coded to spam all types of solar panels, even if you don&#039;t have them.&lt;br /&gt;
&lt;br /&gt;
A better code example can be found here: https://stationeering.com/tools/ic/_2FpoBEcd3QK&amp;lt;br&amp;gt;&lt;br /&gt;
It targets the solar-panel types on &#039;&#039;&#039;d2&#039;&#039;&#039; and (optionally) &#039;&#039;&#039;d3&#039;&#039;&#039;, so it&#039;s less spammy. It also has an option for a display (&#039;&#039;&#039;Kit (Console)&#039;&#039;&#039;) on &#039;&#039;&#039;d1&#039;&#039;&#039; that shows the sum of power output from both types of panels&lt;/div&gt;</summary>
		<author><name>Datzu</name></author>
	</entry>
</feed>