Inumel

Untitled

Oct 6th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. P1 = peripheral.wrap("batbox_7")
  2. P2 = peripheral.wrap("batbox_9")
  3. mon = peripheral.wrap("top")
  4. bridge = peripheral.wrap("right")
  5. tank = peripheral.wrap("iron_tank_valve_0")
  6. while true do
  7. local tableInfo = tank.getTanks("unknown")
  8. for k,v in pairs(tableInfo) do
  9.   for x,y in pairs(v) do
  10.     if x == "amount" then
  11.       amount = y
  12.     end
  13.     if y == "Lava" then
  14.       type = y
  15.     end
  16.   end
  17. end
  18. PW1 = P1.getStored()
  19. PW2 = P2.getStored()
  20. power = PW1 + PW2
  21. PC1 = P1.getCapacity()
  22. PC2 = P2.getCapacity()
  23. capacity = PC1 + PC2
  24. PUF = power / capacity * 100
  25. percent = math.floor(PUF)
  26. local function monitor()
  27.         mon.clear()
  28.         mon.setCursorPos(1,3)
  29.         mon.write("Energy is: "..power.." Out of: "..capacity.."("..percent.."%"..")")
  30.  mon.setCursorPos(1,5)
  31.  mon.write("Tank is currently holding: "..type.."The amount is: "..amount)
  32. end
  33. local function bridgeD()
  34.         bridge.clear()
  35.         bridge.addText(1,12,"Energy is: "..power.." Out of: "..capacity.."("..percent.."%"..")",colors.magenta)
  36. end
  37. monitor()
  38. bridgeD()
  39. sleep(1)
  40. end
Advertisement
Add Comment
Please, Sign In to add comment