Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Split(str,pat)
- local t = {}
- local fpat = "(.-)" .. pat
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- s, e, cap = str:find(fpat, last_end)
- end
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
- return t
- end
- local MFE = peripheral.wrap("back")
- local Titre = "Petite MFE"
- local x,y = term.getSize()
- term.clear()
- for x = 6,47 do
- paintutils.drawPixel(x,9,colors.white)
- paintutils.drawPixel(x,14,colors.white)
- end
- for y = 9,14 do
- paintutils.drawPixel(6,y,colors.white)
- paintutils.drawPixel(47,y,colors.white)
- end
- local Capacity = MFE.getEUCapacity()
- local Energy = MFE.getEUStored()
- local pourcent = ((Energy*100)/Capacity)
- local Resultat = (pourcent/(2.5))
- local String = tostring(Resultat)
- local StringBis = tostring(pourcent)
- local t = Split(StringBis,",")
- local p = Split(String,",")
- local limite = tonumber(p[1])
- for i = 0,limite do
- if limite > 0 then
- i = i+7
- end
- paintutils.drawPixel(i,10,colors.red)
- paintutils.drawPixel(i,11,colors.red)
- paintutils.drawPixel(i,12,colors.red)
- paintutils.drawPixel(i,13,colors.red)
- end
- term.setCursorPos((x-((x/2)+#Titre)),7)
- print(Titre)
- term.setCursorPos((x-((x/2)+#t[1])),16)
- print(t[1].." %")
- sleep(5)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment