Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. local out = "right"
  2. local message = "Cell not detected, checking again in 30 seconds"
  3. local cell = peripheral.wrap("top")
  4. local CellCheck = peripheral.isPresent(cell)
  5. local CellStored = cell.getEnergyStored("top")
  6. local CellFull = cell.getMaxEnergyStored("top")
  7. local cellPercent = math.floor(100*CellStored/CellFull)
  8.  
  9. while true do
  10. if CellCheck = true then
  11. print(tonumber(CellStored).."/"..CellFull.." "..cellPercent.."%")
  12. if CellStored == CellFull then
  13. rs.setoutput(out, true)
  14. sleep(1)
  15. rs.setoutput(out, false)
  16. else
  17. sleep(5)
  18. end
  19. else
  20. print(message)
  21. sleep(30)
  22. end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement