Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Fix for Pastebin get
- -- https://www.mediafire.com/file/1g4d4oon6zaf6po/CC_Pastebin_Fix.zip/file
- --
- -- Manual Instructions
- -- In the computer's command line prompt, enter:
- -- cp rom/programs/http/pastebin pastebin
- -- edit pastebin
- -- Then replace line 24:
- -- "http://pastebin.com/raw.php?i="..textutils.urlEncode( paste )
- -- replace that with:
- -- "http://pastebin.com/raw/"..textutils.urlEncode( paste )
- -- Save and exit, and the pastebin script should work on that system when executed from the root of the drive.
- function manageBR(reactor,rodSetting,onP,offP,pCap)
- local sleepTime = 5 -- Time to wait between checks on reactor.
- local onRF = onP/100*pCap -- Stored RF to activate reactor
- local offRF = offP/100*pCap
- local currRF = reactor.getEnergyStored()
- local cursorY = nil
- print("Setting control rods to " .. rodSetting)
- reactor.setAllControlRodLevels(rodSetting)
- print("Total Power Capacity is " .. pCap .. " RF")
- print("Turning reactor on at " .. onP .. " percent power. " .. onRF)
- print("Turning reactor off at " .. offP .. " percent power. " .. offRF)
- while true do
- currRF = reactor.getEnergyStored()
- if (currRF >= offRF) then
- reactor.setActive(false)
- elseif (currRF <= onRF) then
- reactor.setActive(true)
- end
- term.clearLine()
- term.setCursorPos(1, select(2, term.getCursorPos()))
- term.setTextColor(colors.cyan)
- term.write("Power level = ")
- term.setTextColor(colors.red)
- term.write(currRF)
- term.setTextColor(colors.cyan)
- term.write(". Reactor is active? ")
- if reactor.getActive() then
- term.setTextColor(colors.green)
- else term.setTextColor(colors.red)
- end
- term.write(tostring(reactor.getActive()))
- os.sleep(sleepTime)
- end
- end
- -- Main Script, works for a single reactor
- local r1Rods = 91 -- Control rod insertion percentage.
- local r1onP = 75 -- Percent power at wich the reactor should activate.
- local r1offP = 98 -- Percent power at which the reactor should deactivate.
- local r1PCap = 10000000 -- Max Power Capacity
- local reactor1 = peripheral.find("BigReactors-Reactor")
- term.clear()
- if (reactor1.getConnected()) then
- print("Connected")
- manageBR(reactor1,r1Rods,r1onP,r1offP,r1PCap)
- else
- print("Not Connected")
- end
- print("End Program")
Add Comment
Please, Sign In to add comment