Nike622000

Untitled

Jul 29th, 2016
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. sen = sensor.wrap("front")
  3. mon = peripheral.wrap("right")
  4. mon.setTextScale(1)
  5. i = 0
  6. energy = 0
  7. euquer = 0
  8. euquercounter = 1
  9. euquermittel = 0
  10.  
  11. function displayCopyright()
  12. x,y = mon.getSize()
  13. string = "JoJa Productions"
  14. mon.setCursorPos((x-#string)/2,y)
  15. mon.setTextColor(colors.cyan)
  16. mon.write("Jo")
  17. mon.setTextColor(colors.orange)
  18. mon.write("Ja ")
  19. mon.setTextColor(colors.gray)
  20. mon.write("Productions")
  21. end
  22. while true do
  23. --term.clear()
  24. --term.setCursorPos(1,1)
  25. --term.setTextColor(colors.white)
  26. --term.write("Energy: ")
  27. --term.setTextColor(colors.red)
  28.  
  29. ziele = sen.getTargets()
  30. for k,v in pairs(ziele) do
  31. if v.Position.X==-1
  32. and v.Position.Y==0
  33. and v.Position.Z==0
  34. then
  35. for a,b in pairs(sen.getTargetDetails(k)) do
  36. if type(b)=="table" then
  37. else
  38. if a == "EnergySunken" then
  39. energynew = b
  40. ----print(b)
  41.  
  42. if i == 1 then
  43. energy = energynew-energyold
  44. end
  45.  
  46. energyold = energynew
  47. i = 1
  48. end
  49. end
  50. end
  51. euquer = euquer + math.floor(energy/22)
  52. euquermittel = math.floor(euquer/euquercounter)
  53. euquercounter = euquercounter+1
  54.  
  55. mon.clear()
  56. mon.setCursorPos(1,1)
  57. mon.setTextColor(colors.white)
  58. mon.write("Stromuebersicht")
  59. mon.setCursorPos(1,2)
  60. mon.setTextColor(colors.red)
  61. mon.write("Energy: ")
  62. mon.setTextColor(colors.white)
  63. mon.write(tostring(math.floor(energy/22)))
  64. mon.write(" EU/t")
  65. mon.setCursorPos(1,3)
  66. mon.setTextColor(colors.cyan)
  67. mon.write("Gesamt: ")
  68. mon.setTextColor(colors.white)
  69. mon.write(energynew)
  70. mon.write(" EU")
  71. mon.setTextColor(colors.orange)
  72. mon.setCursorPos(1,4)
  73. mon.write("EU/t Mittelwert: ")
  74. mon.setTextColor(colors.white)
  75. mon.write(math.floor(euquermittel))
  76. mon.write(" EU/t quer")
  77.  
  78. displayCopyright()
  79.  
  80. sleep(1)
  81. end
  82. end
  83. end
Advertisement
Add Comment
Please, Sign In to add comment