IC10
From Unofficial Stationeers Wiki
Revision as of 00:54, 13 May 2024 by Emilgardis (talk | contribs) (→Use more correct name for the language used in chips: new section)
Example code, moved because game changes made it obsolete or because they were unclear
This example script automates autohydro units and powers the lights off during the day when they're not needed. (Hit Expand)
Uses aliases, sub-routines and comments to minimize lines of code and adaptability.
alias vMature r0 alias vOccupied r1 alias isDayLight r2 alias isOccupied r3 alias dSensor d5 #start of Program Loop start: l isDayLight dSensor Activate #Check if it's daytime or not. # For each device, harvest, plant, powerdown, then power on depending on conditions. alias dThisVictim d0 #Begin processing device 0 bdseal dThisVictim HarvestCrop bdseal dThisVictim PlantCrop bgtzal isDayLight PowerDown blezal isDayLight TurnitOn alias dThisVictim d1 #Begin processing device 1 bdseal dThisVictim HarvestCrop bdseal dThisVictim PlantCrop bgtzal isDayLight PowerDown blezal isDayLight TurnitOn alias dThisVictim d2 #Begin processing device 2 bdseal dThisVictim HarvestCrop bdseal dThisVictim PlantCrop bgtzal isDayLight PowerDown blezal isDayLight TurnitOn alias dThisVictim d3 #Begin processing device 3 bdseal dThisVictim HarvestCrop bdseal dThisVictim PlantCrop bgtzal isDayLight PowerDown blezal isDayLight TurnitOn alias dThisVictim d4 #Begin processing device 4 bdseal dThisVictim HarvestCrop bdseal dThisVictim PlantCrop bgtzal isDayLight PowerDown blezal isDayLight TurnitOn #Can't do a D5 because that's our sensor. j start #Return to the beginning of the program loop. (Yields here may save processing power) HarvestCrop: ls vMature dThisVictim 0 Mature blez vMature ra #If the crop is not mature, return s dThisVictim Harvest 1 #If the crop is mature, harvest it (one). j ra #return PlantCrop: ls vOccupied dThisVictim 2 Occupied #seeds to plant blez vOccupied ra #If the machine has no seeds to plant, return. ls vOccupied dThisVictim 0 Occupied #something growing bgtz vOccupied ra # If the crop plot is occupied, return. s dThisVictim Plant 1 # if we made it this far, plant the crop j ra #return PowerDown: s dThisVictim On 0 #Power the machine down. j ra #Jump to line we came from TurnitOn: s dThisVictim On 1 #Power the machine up j ra ########## #### End Script ##########
This is a sample timer command set, alternating between 1 for 1 tick (0.5s), then off for 2 ticks (1s).
move r0 0 # Line 0: move the value 0 to register0 sub r1 r0 3 # Line 1: subtract 3 from the value in r0 and write it to r1 bltz r1 4 # Line 2: jump to line 4 if r1 < 0 (skip the next line) move r0 0 # Line 3: move the value 0 to register0 slt o r0 1 # Line 4: if r0 < 1 write 1 to the output, otherwise 0. add r0 r0 1 # Line 5: increment r0 by 1 yield # Line 6: wait until next power tick (0.5s) j 1 # Line 7: jump back to line 1 ########## #### End Script ##########
Example:
so you will do l r0 d0 SolarAngle Sorry had last args swapped That would read in the value while, s d1 Vertical r0 Would write the contents of r0 into the devices 1's Vertical property additionally you can make some aliases alias SolarSensor d0 l r0 SolarSensor SolarAngle ########## #### End Script ##########
Another example:
Now the IC is inserted into the housing. The screws D0-D5 can be adjusted directly to the equipment (sensor, console, solar panel, etc.). The ports 'o' and 'i0-i2' have been removed. Instead, commands that directly read and write hardware parameters are added. l <register> <data_channel> <parameter> reads the value of the parameter s <data_channel> <parameter> <register_or_value> writes the value of the parameter ls <register> <data_channel> <slot_number> <parameter> reads the parameter value from the slot For example, l r0 d0 Horizontal s d5 Activate 1 ls r3 db 0 OccupantHash ########## #### End Script ##########
Use more correct name for the language used in chips
I propose that we rename this page and change the content and related templates (Template:MIPSCode, Template:MIPSInstruction) to use IC instead of MIPS. The language Integrated_Circuit (IC10) chips use in game is not MIPS, it's a proprietary language derived from MIPS, commonly refereed to by the community as IC10. I've not been able to confidently find an official mention of IC10 actually being the name of the language however, in source it's referred to as Instruction and in update posts when calling out changes it's called either IC code or IC instructions.
Emilgardis (talk) 01:54, 13 May 2024 (CDT)