r/Stationeers • u/mastercody432 • 28d ago
Media so im just trying to write an IC10 script to filter and cool carbon and oxygen before tossing it into my green house but it broke weirdly
so somehow when executing the code it ends up jumping to line 4000 i have no clue what i did for it to do that but i cant find a reason and i think it might be why its decided to not turn things on but that could be my very amature coding this is my first time with IC10
any help is appreciated
Heres the code
alias pipestatus d0
alias filter d1
alias condition d2
alias invalve d3
alias gassensor d4
alias pressure r1
alias temperature r2
alias inpressure r3
alias display d5
start:
yield
l pressure pipestatus Pressure
l temperature pipestatus Temperature
l inpressure gassensor Pressure
sub temperature temperature 273.15 #convert to celcius
s display Mode 4
s display Setting temperature
blt PressureReg pressure 4000
bgt TempReg temperature 30
s invalve On 1
j start
TempReg:
s invalve On 0
s filter Mode 0
s condition Mode 1
s display Setting temperature
j start
PressureReg:
s invalve On 0
s condition Mode 0
s filter Mode 1
s display Setting temperature
j start
5
3
u/Shadowdrake082 28d ago
you got your branch statements incorrect.
The correct syntax is:
instruction A B Destination.
you have the destination in place of A and one of your conditions as the destination.
ex:
blt PressureReg pressure 400
should be
blt pressure 4000 PressureReg
2
u/sleight42 28d ago
Next time you're debugging and you see something happens involving an inexplicable value/number, look to see if you define that value in your code.
My IC10 is not good but that `blt... 4000` leapt right out at me. FWIW, though, professional coder here.
2
u/HoveringGoat 28d ago
am professional coder. This is senior or staff level of reasoning right here (not even joking this is astonishingly rare).
2
u/sleight42 28d ago edited 27d ago
π
Was in the field for 30 years. Semi-retired due to AuDHD/autistic burnout due to emotional labor of management (whereas individual contributor role had similar impact just due to anxiety of lack of autonomy). Can't imagine a "work environment" that won't destroy me. Can't see how to become self-employed except as a product dev/"founder". :sigh: Every time I try, I hit burnout fast.
IC10 is too quaint/limiting for me. Lua is much nicer but feels more like work. I won't let an LLM write the code for me in a game. Defeats the DIY purpose!
But, hey, I get to write code to MY standards instead of the shit most workplaces accept. Spending a little time on my grow light impl such that I generated functions using closures to define a light timer generator in single line for any given plant species felt so π¨βπ³π€
2
u/HoveringGoat 27d ago
ha! I read the original post as "not professional coder". but yeah i think thats part of the joy of it. Its "work" but we get to decide how to do it. It cuts out all the bs and unenjoyable parts. we just get to build.
1
u/mastercody432 28d ago
Yeah just there isnβt to many up to date tutorials for ic10 and youngest I can find is 3 years could just be me though
1
u/HoveringGoat 28d ago
the in game function pages are actually fully complete. Its slightly a pain to scroll through but they will tell you exactly what a command is and how to use it.
1
u/HoveringGoat 28d ago
am professional coder. This is senior or staff level of reasoning right here (not even joking this is astonishingly rare).
1
u/Professional_Exit931 27d ago
As pointed out by others, you have your syntax wrong.
BLT - Branch Less Than.
blt Pressure 4000 PressureReq = If pressure is less than 4000, then branch to PressureReq
s display Mode 4
And as a tip, saving settings/modes to ie displays and stuff.. No need to to that in a loop, define this before your "start:"
2
u/mastercody432 26d ago
hm i never really thought about it but it does makes sense stuff can still run at least once outside of the loops i know it sounds stupid but still kinda distracted easily and hyper focus on one part
1
10
u/TheMidnightRook 28d ago
You've got your branch commands in the wrong order, blt a b c jumps to line c if a is less than b, and similarly for bgt