- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
Azrdraco
-
Content Count
2 -
Joined
-
Last visited
Posts posted by Azrdraco
-
-
Hello,
I'm working on a program to run my Big Reactor (ala Direwolf20's recent CC program)
I started yesterday knowing very little about writing code and have managed to program the basic function which I wanted to start out with. I'm hoping to add more monitoring and adjustment functions later as I learn more, but this what I need to start off.
I want my reactor to shut off when the energy buffer is at 90% and restart when the buffer is down to 10%. My buffer is currently 10mil RF.
It works, once. If I run when the buffer is near full, it will shut down, and if I run the program when the buffer is low, it will start the reactor. It does not, however, shut the reactor back down once it is near full unless I rerun the program.
My question is what do I need to add in order to have this run in the background and continuously manage my reactor?
Here's my code:
component = require("component")
RF_BUFFER_MAX = 9000000
RF_BUFFER_MIN = 1000000
for _, reactor in pairs(REACTORS) do
if reactor.getEnergyStored() >= RF_BUFFER_MAX then
reactor.setActive(false)
print("Reactor is offline")
else if reactor.getEnergyStored() <=RF_BUFFER_MIN then
reactor.setActive(true)
print("Reactor is online")
end
end
Thank you for any insight that you can give!
OC and Big Reactors
in Programming
Posted
Thank you for your help!
Quick question on the process api. Is that something I should add to my init file, or include in my program above?