Starbase

Starbase

78 ratings
Automatic Generator Output With Basic YOLOL
By Nukyo
A super simple way to modify your ship for automated energy/fuel management with YOLOL code in Starbase.
4
2
3
   
Award
Favorite
Favorited
Unfavorite
Introduction
You can easily modify your ship to save tons of energy and avoid replacing fuel rods every so often.

With a basic script coded in YOLOL, Starbase's programming language, your ship generator will turn off and on automatically depending on battery charge and regulate how much output is currently necessary.

It's a simple solution to avoid having to turn the generator on and off manually every time the ship stops moving.
What you need
  • A ship equipped with a generator and battery.
  • A YOLOL Chip Socket
  • A Basic YOLOL Chip
  • Cable and bolt tools.
You can get these from the auction house or craft them yourself at a crafting bench.




Install the YOLOL Chip
Simply bolt the YOLOL Chip Socket to a beam on your ship using the bolt tool.

Then, put the Basic YOLOL Chip inside the Socket.

Finally, link the Socket to the generator network using the cable tool.

Program the YOLOL Chip
To edit the YOLOL script inside the chip, press the center lock and slide it down.

Put the following line of code inside on the first line.

:FuelChamberUnitRateLimit=100-:StoredBatteryPower/100 goto 1

Debugging
You can always rename the device fields FuelChamberUnitRateLimit as GeneratorOutput and StoredBatteryPower as BatteryCharge for example if you want to.

In fact, they should have similar names in the YOLOL script and the battery and the generator fuel chamber installed on your ship.

To rename device fields, use the universal tool. Press u pointing at the device, then go to the data tab to edit.

Show me some love

-
9 Comments
kajanov Jul 25, 2024 @ 3:24pm 
How does it be have when you set GeneratorUnitRateLimit to a negative value. If it's the same as zero you cn put hte baseline at 99 instead of 100 to be sure the generator shuts down at 99% battery capacity.
Endottus Apr 14, 2023 @ 5:15pm 
:GeneratorUnitRateLimit=1000-:StoredBatteryPower/10 goto 1
and never touch it again
0x0x0™ Dec 23, 2022 @ 8:51am 
Thanks for POSTING dude ;)
ibuildblasters Oct 7, 2021 @ 4:03pm 
an OR for shutdown?
ibuildblasters Oct 7, 2021 @ 4:01pm 
Bane, what would you do to add a shutdown button?
Nukyo  [author] Aug 15, 2021 @ 6:46pm 
Yes good input. People can play around with the divider value to see what suits the ship and its usage best. 100 is a good starter but if you feel adventurous, feel free to experiment.
Bane Silvermoon Aug 15, 2021 @ 7:39am 
You can actually push this to a ridiculously efficient value if your battery bank is large enough to give the generator time to spin up. I was using a divider of 275 at one point and it worked. But I found I still had to pay attention sometimes to make sure my batteries didn't fully drain. At 275, it took a while to recharge them, making a full drain painful.

My current generator yolol looks like this.

:GenRate=((10000-:Battery)/175)+1
IF :Battery==10000 THEN :Shutdown=0 goto 1 END
IF :Battery<8000 THEN :Shutdown=100 goto 1 END
goto 1


GenRate - GeneratorUnitRateLimit field
Shutdown - FuelChamberUnitRateLimit field
Battery - StoredBatteryPower field

I don't even use a shutdown button anymore. Instead I just make sure to despawn my ship if I'm going to leave it parked somewhere for a long time. The battery drain idles so low it doesn't matter. I could probably take that 175 higher, but I don't plan to fly this ship much longer so I've stopped tweaking this one.
Nukyo  [author] Aug 12, 2021 @ 6:34pm 
No problem. Glad it helps. Feel free to ask for help.
usurpine Aug 12, 2021 @ 12:55pm 
I love you ;):steamthumbsup: