Advertisement
Guest User

energy.lua

a guest
Jan 8th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. s = sleep(0.2)
  2. a = peripheral.wrap("back")
  3. mon = peripheral.wrap("left")
  4.  
  5. mon.clear()
  6.  
  7. function init()
  8.     ballMin = a.getEnergyStored()
  9.     ballMax = a.getMaxEnergyStored()
  10. end
  11. init()
  12. function math()
  13.     ballMinNow = ballMin
  14.     sleep(0.5)
  15.     ballMinLater = ballMin
  16.     ballState = ballMinLater - ballMinNow
  17.     mon.setCursorPos(1,2)
  18.     mon.setTextColor(colors.white)
  19.     print(ballMin)
  20.     mon.write(ballState)
  21. end
  22.  
  23. function update()
  24. math()
  25. end
  26. sleep(s)
  27.  
  28.  
  29. while true do
  30.     mon.clear()
  31.     update()
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement