Advertisement
Evdev

controller

Jul 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. term.clear()
  2.  
  3. local args = {...}
  4.  
  5. if #args ~= 1 then
  6. print("USAGE: controller <target power percentage (between 0 and 100)>")
  7. return
  8. end
  9.  
  10. reactor = peripheral.wrap("back")
  11.  
  12. while true do
  13. local currentRF = reactor.getEnergyStored()
  14.  
  15. local RFPer = (currentRF / 10000000) * 100
  16.  
  17. local currentPer = (RFPer / args[1]) * 100
  18.  
  19. term.setCursorPos(1,1)
  20.  
  21. print("Current control rod target: "..currentPer)
  22.  
  23. if currentPer > 100 then
  24. currentPer = 100
  25. end
  26.  
  27. math.floor(currentPer)
  28.  
  29. reactor.setAllControlRodLevels(currentPer)
  30.  
  31. sleep(.1)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement