Darknio icon

energie

Darknio | PRO | 01/13/16 05:47:35 AM UTC | 0 ⭐ | 390 👁️ | Never ⏰ | []
Lua |

1.72 KB

|

None

|

0 👍

/

0 👎

draco_Slot          = "draconic_rf_storage_0"
mon_Slot            = "monitor_0"
 
counter             = 0
progessBarColor     = colors.lightBlue
 
 
--mon.setBackgroundColor(colors.white)
--mon.setTextColor(colors.black)
 
mon                 = peripheral.wrap(mon_Slot)
storage             = peripheral.wrap(draco_Slot)
function Update()
 
energy_Storage      = storage.getEnergyStored()
energy_Storage_Max  = storage.getMaxEnergyStored()
 
storage_Prozent     = energy_Storage/energy_Storage_Max * 100
storage_Prozent_New = math.ceil(storage_Prozent)
 
progessBar          = storage_Prozent_New/4
 
 
if storage_Prozent_New < 50 then
progessBarColor     = colors.red
progessBarColorTwo  = colors.black
else
progessBarColor     = colors.lightBlue
 
end
 
end
 
function Screen()
 
mon.setCursorPos (8,1)
mon.write("Energiespeicher")
mon.setCursorPos(6,5)
mon.write(energy_Storage .. " / " .. energy_Storage_Max)
 
 
 
end
 
function Ladebalken()
mon.clear()
mon.setCursorPos(1,2)
for i = 1,10 do
mon.setBackgroundColor(colors.black)
mon.write("   ")
end
mon.setCursorPos(1,2)
for i = 1,progessBar do
mon.setBackgroundColor(progessBarColor)
mon.write(" ")
end
mon.setCursorPos(1,3)
for i = 1,10 do
mon.setBackgroundColor(colors.black)
mon.write("   ")
end
mon.setCursorPos(1,3)
for i = 1,progessBar do
mon.setBackgroundColor(progessBarColor)
mon.write(" ")
end
mon.setCursorPos(1,4)
for i = 1,10 do
mon.setBackgroundColor(colors.black)
mon.write("   ")
end
mon.setCursorPos(1,4)
for i = 1,progessBar do
mon.setBackgroundColor(progessBarColor)
mon.write(" ")
end
mon.setBackgroundColor(colors.white)
mon.setTextColor(colors.black)
end
 
 
 
 
while true do 
term.clear()
term.setCursorPos(1,1)
print(progessBar)
Update()
Ladebalken()
Screen()
sleep (1)
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎