Advertisement
Guest User

startup

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