Advertisement
MonschTHEGAME

Draconic Energy Core Readout

Jan 24th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. monitor = peripheral.wrap("back")
  2. term.redirect(monitor)
  3.  
  4. p = peripheral.wrap("draconic_rf_storage_3")
  5.  
  6. term.setBackgroundColor(colors.white)
  7. term.setTextColor(colors.black)
  8.  
  9. function Pos(x,y)
  10. term.setCursorPos(x,y)
  11. end
  12.  
  13. function shorten(str)
  14. tostring(str)
  15. str = string.sub(str, 1, 6)
  16. return str
  17. end
  18.  
  19. function UpdateReadout()
  20. current = p.getEnergyStored()
  21. maximum = p.getMaxEnergyStored()
  22. term.clear()
  23. Pos(1,1)
  24. term.write(" Draconic Energy Core:")
  25. monitor.setTextScale(1.5)
  26. Pos(1,3)
  27. term.write(" Stored Energy: "..current)
  28. Pos(1,5)
  29. term.write(" Max Energy: "..maximum)
  30. Pos(1,7)
  31. amountInt = ((current * 100) / maximum)
  32. term.write(" Percent: "..shorten(amountInt))
  33. end
  34.  
  35. while true do
  36. UpdateReadout()
  37. os.sleep(0.5)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement