Advertisement
ecco7777

CC energie anzeige für viele mfsu

Sep 27th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. n1=peripheral.wrap("bottom")
  2. n2=peripheral.wrap("left")
  3. n3=peripheral.wrap("right")
  4. n4=peripheral.wrap("back")
  5.  
  6. function getEnergy()
  7. energy=0
  8. max=0
  9. zc=1
  10. while zc<=9 do
  11. a,b,c,d=n1.get(zc) a1,b1,c1,d1=n2.get(zc) a2,b2,c2,d2=n3.get(zc) a3,b3,c3,d3=n4.get(zc)
  12. energy=energy+d["energyL"] energy=energy+d1["energyL"] energy=energy+d2["energyL"] energy=energy+d3["energyL"]
  13. max=max+d["maxStorageL"] max=max+d1["maxStorageL"] max=max+d2["maxStorageL"] max=max+d3["maxStorageL"]
  14. zc=zc+1
  15. end
  16. end
  17.  
  18.  
  19. m=peripheral.wrap("top")
  20. m.setTextColor(1)
  21. m.setTextScale(1)
  22. while true do
  23. getEnergy()
  24. x=30/max*energy
  25. pro=100/max*energy
  26. m.setBackgroundColor(32768)
  27. m.clear()
  28. m.setTextColor(1)
  29. m.setCursorPos(1,1)
  30. m.write(pro)m.setCursorPos(4,1)m.write("%                           ")
  31. m.setCursorPos(1,2)
  32. m.write("Aktuelle Energie:"..energy)
  33. m.setCursorPos(1,3)
  34. m.write("Maximale Energie:"..max)
  35. m.setCursorPos(1,5)
  36. if pro<20 then m.setBackgroundColor(16384) end
  37. if pro>20 and pro<60 then m.setBackgroundColor(2) end
  38. if pro>60 then m.setBackgroundColor(32) end
  39. y=0
  40. while y<x do
  41. m.write(" ")
  42. y=y+1
  43. end
  44. sleep(1)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement