Justiik

Untitled

Oct 27th, 2021 (edited)
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. tank = peripheral.wrap("bottom")
  2. inventory = tank.getTanks()
  3. modem = peripheral.wrap("top")
  4. modem.open(200)
  5.  
  6.  
  7. tank.capacity = inventory[1].amount
  8. tank.amount = inventory[1].capacity
  9. tank.name = inventory[1].name
  10.  
  11. function math.percentProgress(cur_value, maxvalue, decimal)
  12. cur_value, maxvalue, decimal = tonumber(cur_value), tonumber(maxvalue), decimal or 1
  13. if (cur_value and maxvalue) then
  14. local percent = tostring((cur_value/maxvalue)*100)
  15. return string.format('%'..tostring(decimal)..'f%%', percent)
  16. end
  17. return false
  18. end
  19. n = math.percentProgress(tank.capacity, tank.amount, 0)
  20. nn = print(n)
  21.  
  22. if nn==20 then
  23. prbar = "[##========]"
  24.  
  25. else
  26. prbar = "[==========]"
  27. end
  28.  
  29. modem.transmit(200,1,n.." of "..tank.name)
  30. nn = print(n)
  31.  
  32. term.clear()
  33. while true do
  34. term.setCursorPos(5,2)
  35. print(n.." of "..tank.name)
  36. term.setCursorPos(5,6)
  37. print(prbar)
  38. modem.transmit(200,1,n.." of "..tank.name)
  39. sleep(10)
  40. end
Add Comment
Please, Sign In to add comment