Darknio

energie

Jan 13th, 2016
331
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. draco_Slot          = "draconic_rf_storage_0"
  2. mon_Slot            = "monitor_0"
  3.  
  4. counter             = 0
  5. progessBarColor     = colors.lightBlue
  6.  
  7.  
  8. --mon.setBackgroundColor(colors.white)
  9. --mon.setTextColor(colors.black)
  10.  
  11. mon                 = peripheral.wrap(mon_Slot)
  12. storage             = peripheral.wrap(draco_Slot)
  13. function Update()
  14.  
  15. energy_Storage      = storage.getEnergyStored()
  16. energy_Storage_Max  = storage.getMaxEnergyStored()
  17.  
  18. storage_Prozent     = energy_Storage/energy_Storage_Max * 100
  19. storage_Prozent_New = math.ceil(storage_Prozent)
  20.  
  21. progessBar          = storage_Prozent_New/4
  22.  
  23.  
  24. if storage_Prozent_New < 50 then
  25. progessBarColor     = colors.red
  26. progessBarColorTwo  = colors.black
  27. else
  28. progessBarColor     = colors.lightBlue
  29.  
  30. end
  31.  
  32. end
  33.  
  34. function Screen()
  35.  
  36. mon.setCursorPos (8,1)
  37. mon.write("Energiespeicher")
  38. mon.setCursorPos(6,5)
  39. mon.write(energy_Storage .. " / " .. energy_Storage_Max)
  40.  
  41.  
  42.  
  43. end
  44.  
  45. function Ladebalken()
  46. mon.clear()
  47. mon.setCursorPos(1,2)
  48. for i = 1,10 do
  49. mon.setBackgroundColor(colors.black)
  50. mon.write("   ")
  51. end
  52. mon.setCursorPos(1,2)
  53. for i = 1,progessBar do
  54. mon.setBackgroundColor(progessBarColor)
  55. mon.write(" ")
  56. end
  57. mon.setCursorPos(1,3)
  58. for i = 1,10 do
  59. mon.setBackgroundColor(colors.black)
  60. mon.write("   ")
  61. end
  62. mon.setCursorPos(1,3)
  63. for i = 1,progessBar do
  64. mon.setBackgroundColor(progessBarColor)
  65. mon.write(" ")
  66. end
  67. mon.setCursorPos(1,4)
  68. for i = 1,10 do
  69. mon.setBackgroundColor(colors.black)
  70. mon.write("   ")
  71. end
  72. mon.setCursorPos(1,4)
  73. for i = 1,progessBar do
  74. mon.setBackgroundColor(progessBarColor)
  75. mon.write(" ")
  76. end
  77. mon.setBackgroundColor(colors.white)
  78. mon.setTextColor(colors.black)
  79. end
  80.  
  81.  
  82.  
  83.  
  84. while true do
  85. term.clear()
  86. term.setCursorPos(1,1)
  87. print(progessBar)
  88. Update()
  89. Ladebalken()
  90. Screen()
  91. sleep (1)
  92. end
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment