SHOW:
|
|
- or go back to the newest paste.
| 1 | - | function manageBR(r1) |
| 1 | + | -- Fix for Pastebin get |
| 2 | - | print("r1 is active?")
|
| 2 | + | -- https://www.mediafire.com/file/1g4d4oon6zaf6po/CC_Pastebin_Fix.zip/file |
| 3 | -- | |
| 4 | -- Manual Instructions | |
| 5 | -- In the computer's command line prompt, enter: | |
| 6 | -- cp rom/programs/http/pastebin pastebin | |
| 7 | - | local reactor |
| 7 | + | -- edit pastebin |
| 8 | - | reactor = peripheral.wrap("back")
|
| 8 | + | -- Then replace line 24: |
| 9 | -- "http://pastebin.com/raw.php?i="..textutils.urlEncode( paste ) | |
| 10 | - | if (reactor.getConnected()) then |
| 10 | + | -- replace that with: |
| 11 | - | print("Connected")
|
| 11 | + | -- "http://pastebin.com/raw/"..textutils.urlEncode( paste ) |
| 12 | - | manageBR(reactor) |
| 12 | + | -- Save and exit, and the pastebin script should work on that system when executed from the root of the drive. |
| 13 | ||
| 14 | - | print("Not Connected")
|
| 14 | + | |
| 15 | function manageBR(reactor,rodSetting,onP,offP,pCap) | |
| 16 | local sleepTime = 5 -- Time to wait between checks on reactor. | |
| 17 | local onRF = onP/100*pCap -- Stored RF to activate reactor | |
| 18 | local offRF = offP/100*pCap | |
| 19 | local currRF = reactor.getEnergyStored() | |
| 20 | local cursorY = nil | |
| 21 | ||
| 22 | print("Setting control rods to " .. rodSetting)
| |
| 23 | reactor.setAllControlRodLevels(rodSetting) | |
| 24 | print("Total Power Capacity is " .. pCap .. " RF")
| |
| 25 | print("Turning reactor on at " .. onP .. " percent power. " .. onRF)
| |
| 26 | print("Turning reactor off at " .. offP .. " percent power. " .. offRF)
| |
| 27 | ||
| 28 | while true do | |
| 29 | currRF = reactor.getEnergyStored() | |
| 30 | ||
| 31 | if (currRF >= offRF) then | |
| 32 | reactor.setActive(false) | |
| 33 | elseif (currRF <= onRF) then | |
| 34 | reactor.setActive(true) | |
| 35 | end | |
| 36 | ||
| 37 | term.clearLine() | |
| 38 | term.setCursorPos(1, select(2, term.getCursorPos())) | |
| 39 | term.setTextColor(colors.cyan) | |
| 40 | term.write("Power level = ")
| |
| 41 | term.setTextColor(colors.red) | |
| 42 | term.write(currRF) | |
| 43 | term.setTextColor(colors.cyan) | |
| 44 | term.write(". Reactor is active? ")
| |
| 45 | ||
| 46 | if reactor.getActive() then | |
| 47 | term.setTextColor(colors.green) | |
| 48 | else term.setTextColor(colors.red) | |
| 49 | end | |
| 50 | ||
| 51 | term.write(tostring(reactor.getActive())) | |
| 52 | ||
| 53 | ||
| 54 | os.sleep(sleepTime) | |
| 55 | end | |
| 56 | end | |
| 57 | ||
| 58 | ||
| 59 | -- Main Script, works for a single reactor | |
| 60 | ||
| 61 | local r1Rods = 91 -- Control rod insertion percentage. | |
| 62 | local r1onP = 75 -- Percent power at wich the reactor should activate. | |
| 63 | local r1offP = 98 -- Percent power at which the reactor should deactivate. | |
| 64 | local r1PCap = 10000000 -- Max Power Capacity | |
| 65 | local reactor1 = peripheral.find("BigReactors-Reactor")
| |
| 66 | ||
| 67 | term.clear() | |
| 68 | ||
| 69 | if (reactor1.getConnected()) then | |
| 70 | print("Connected")
| |
| 71 | manageBR(reactor1,r1Rods,r1onP,r1offP,r1PCap) | |
| 72 | else | |
| 73 | print("Not Connected")
| |
| 74 | end | |
| 75 | ||
| 76 | print("End Program") |