Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local capacity = 504 * 1000
- local monitor = peripheral.wrap("front")
- local tank = peripheral.wrap("right")
- local function drawBar(x, y, width, fillPercentage)
- local fillWidth = math.floor(width * fillPercentage)
- paintutils.drawLine(1, 1, 10, 1, colors.lime)
- paintutils.drawLine(27, 1, 40, 1, colors.lime)
- term.redirect(monitor)
- monitor.setBackgroundColor(colors.white)
- monitor.setTextColor(colors.black)
- monitor.setCursorPos(x, y)
- monitor.write("[ ")
- for i = 1, width do
- if i <= fillWidth then
- monitor.setBackgroundColor(colors.green)
- monitor.write(" ")
- else
- monitor.setBackgroundColor(colors.red)
- monitor.write(" ")
- end
- end
- monitor.setBackgroundColor(colors.white)
- monitor.write(" ] " .. string.format("%.2f", fillPercentage * 100) .. "%") -- Yüzdeliği ondalık olarak göstermek için %.2f formatını kullanıyoruz
- end
- while true do
- local tanks = tank.tanks()
- local info = tanks[1]
- monitor.clear()
- monitor.setTextScale(0.9)
- monitor.setCursorPos(5, 1)
- monitor.write(" [INFO SCREEN] ")
- monitor.setCursorPos(1, 3)
- monitor.setBackgroundColor(colors.white)
- monitor.setTextColor(colors.lime)
- local infotk = info and (info.amount / 1000 * 1000) or 0
- local capacityMB = capacity
- local percentFull = (info and info.amount or 0) / capacity * 100
- monitor.write("Total: " .. infotk .. " MB xp")
- monitor.setCursorPos(1, 5)
- monitor.write("Capacity: " .. capacityMB .. " MB")
- drawBar(1, 7, 20, percentFull / 100)
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement