edoreld

Untitled

Jun 9th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. local lamps = {
  2. [1] = peripheral.wrap("glowstone_illuminator_0"),
  3. [2] = peripheral.wrap("glowstone_illuminator_1"),
  4. [3] = peripheral.wrap("glowstone_illuminator_2"),
  5. [4] = peripheral.wrap("glowstone_illuminator_3"),
  6. [5] = peripheral.wrap("glowstone_illuminator_4"),
  7. [6] = peripheral.wrap("glowstone_illuminator_5"),
  8. [7] = peripheral.wrap("glowstone_illuminator_7"),
  9. [8] = peripheral.wrap("glowstone_illuminator_8"),
  10. [9] = peripheral.wrap("glowstone_illuminator_9"),
  11. [10] = peripheral.wrap("glowstone_illuminator_10")
  12. }
  13. local tank = peripheral.wrap("back")
  14. local tankinfo = tank.getTanks("unknown")
  15. --print(textutils.serialize(tankinfo))
  16. local percentage = tankinfo[1].amount / tankinfo[1].capacity * 100
  17. for key,value in pairs(lamps) do
  18. value.setColor(0x000000)
  19. end
  20.  
  21. while true do
  22. for i=1,10,1 do
  23. lamp = lamps[i]
  24. if (percentage > ((i - 1) * 10)) then
  25. lamp.setColor(0xFF0000)
  26. else
  27. lamp.setColor(0xFFFFFF)
  28. end
  29. end
  30. print(percentage)
  31. os.sleep(1)
  32.  
  33. tankinfo = tank.getTanks("unknown")
  34. percentage = tankinfo[1].amount / tankinfo[1].capacity * 100
  35.  
  36. end
Advertisement
Add Comment
Please, Sign In to add comment