edoreld

Untitled

Jun 9th, 2013
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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.  
  17. local percentage = 0
  18. if tankinfo[1].amount ~= nil then
  19. percentage = tankinfo[1].amount / tankinfo[1].capacity * 100
  20. end
  21.  
  22. for key,value in pairs(lamps) do
  23. value.setColor(0x000000)
  24. end
  25.  
  26. while true do
  27. for i=1,10,1 do
  28. lamp = lamps[i]
  29. if (percentage > ((i - 1) * 10)) then
  30. lamp.setColor(0xFF0000)
  31. else
  32. lamp.setColor(0x000000)
  33. end
  34. end
  35. print(percentage)
  36. os.sleep(1)
  37.  
  38. tankinfo = tank.getTanks("unknown")
  39. percentage = 0
  40. if tankinfo[1].amount ~= nil then
  41. percentage = tankinfo[1].amount / tankinfo[1].capacity * 100
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment