kd8lvt

Reactor Program for OCDiary

Mar 13th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. --A QUICK NOTE: You have to set the max power the reactor can store, and the minimum!!! There is NO way to set them automatically!
  2. --ALSO: This was made for OCDiary, but anyone can use it!
  3. --AS WELL: in a computer do "pastebin get c4ZSKtaE startup" without the quotes to download this. Keeping the computer and reactor chunkloaded is a good idea.
  4. --Variables and Peripherals
  5. r= peripheral.wrap("back") --Change this to the side that the Reactor Peripheral Port is on.
  6. --Maximum Power you want IN THE REACTOR at a time.
  7. powermax=
  8. --Minimum Power you want IN THE REACTOR at a time.
  9. powermin=
  10. --Funcions
  11. function main()
  12.     while true do
  13.         --A loop that runs every ten seconds.
  14.         power= r.getEnergyStored()
  15.         if power < powermin then
  16.             if r.getActive() == false then
  17.                 r.setActive(true)
  18.             end
  19.         end
  20.         if power > powermax then
  21.             if r.getActive() == true then
  22.                 r.setActive(false)
  23.             end
  24.         end
  25.         sleep(10)
  26.     end
  27. end
  28. --Main Program
  29. main()
Advertisement
Add Comment
Please, Sign In to add comment