Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nb = peripheral.wrap("top")
- local mon = peripheral.wrap("bottom")
- local all = 0
- local mfsu = {11,12}
- local strom = {}
- local length = 30
- local function printCenter(mon, txt)
- local w, h = mon.getSize()
- local x = math.floor((w / 2) - (#txt / 2))
- local y = math.floor((h / 2))
- mon.setCursorPos(x, y)
- mon.write(txt)
- end
- function createBox(x,y,width,height,color,mon)
- mon.setCursorPos(x,y)
- for j = 0, height do
- mon.setCursorPos(x,y+j)
- for i = 0,width do
- mon.setBackgroundColor(color)
- mon.write(" ")
- end
- end
- end
- function clear(mon)
- local w,h = mon.getSize()
- for i = 0,h do
- for j = 0, w do
- mon.setCursorPos(1+j,1+i)
- mon.setBackgroundColor(colors.black)
- mon.write(" ")
- end
- end
- end
- clear(mon)
- function getAllEU()
- local all = 0
- for i = mfsu[1], tablelength(mfsu)+mfsu[1]-1 do
- all = all + strom[i]
- end
- return all
- end
- function tablelength(T)
- local count = 0
- for _ in pairs(T) do count = count + 1 end
- return count
- end
- while true do
- for i = mfsu[1], tablelength(mfsu)+mfsu[1]-1 do
- EU = nb.callRemote("batbox_"..i, "getStored")
- print(EU)
- strom[i] = EU
- end
- red = length / (tablelength(mfsu) * 10000000) * getAllEU()
- clear(mon)
- createBox(6,3,length,2,colors.blue,mon)
- createBox(6 + red - 2,0,1,7,colors.red,mon)
- mon.setTextColor(colors.white)
- mon.setCursorPos(0,9)
- mon.setBackgroundColor(colors.black)
- printCenter(mon, getAllEU() .."/".. (tablelength(mfsu) * 10000000).."EU")
- --text = p.addText(3,3 , getAllEU() .."/".. (tablelength(mfsu) * 10000000).."EU", 0x000000)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment