Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function terminal.bar(
- pos1,
- pos2,
- length,
- height,
- ins,
- max,
- color1,
- color2,
- color3,
- printval,
- hor,
- text,
- format,
- rect,
- thicc)
- if (ins == nil) or (ins < 0) then
- ins = 0
- end
- if format == nil then
- local format = false
- end
- if ins ~= nil then
- oldcol = term.getBackgroundColor()
- oldcol1 = term.getTextColor()
- term.setTextColor(colors[color3])
- local function reprint()
- term.setBackgroundColor(colors[color1])
- terminal.fill(pos1 - 1, pos2 - height, length, height * 2)
- term.setBackgroundColor(oldcol)
- xm = term.getBackgroundColor()
- xb = term.getTextColor()
- term.setTextColor(xm)
- term.setBackgroundColor(xb)
- term.setCursorPos(pos1 - 1, pos2 - height)
- if thicc then
- term.setBackgroundColor(colors[color3])
- end
- if thicc then
- term.write(string.rep("\x83", length + 1)) --\143
- term.setTextColor(xb)
- term.setBackgroundColor(xm)
- else
- term.write("\159" .. string.rep("\143", length - 1)) --\x83
- term.setTextColor(xb)
- term.setBackgroundColor(xm)
- term.write("\144")
- end
- if thicc then
- term.setBackgroundColor(colors[color3])
- end
- term.setCursorPos(pos1 - 1, pos2 + height)
- if thicc then
- term.write(string.rep("\x8c", length + 1)) --\131
- else
- term.write("\130" .. string.rep("\131", length - 1) .. "\129") --\x8c
- end
- for i = 0, (height * 2) - 2 do
- if not thicc then
- term.setTextColor(xm)
- term.setBackgroundColor(xb)
- end
- term.setCursorPos(pos1 - 1, (pos2 + i) - (height) + 1)
- if thicc then
- term.setBackgroundColor(colors[color3])
- end
- term.write("\x95")
- term.setCursorPos((pos1 - 2) + (length + 1), (pos2 + i) - (height) + 1)
- if not thicc then
- term.setTextColor(xb)
- term.setBackgroundColor(xm)
- end
- term.write("\x95")
- end
- end
- if rect ~= false then
- reprint()
- else
- terminal.fill(pos1 - 1, pos2 - height, length, height * 2)
- end
- local drawLength = ins / max * length
- local drawHeights = ins / max * height
- local drawHeight = math.ceil(drawHeights)
- local moveval = (drawHeight * 2) - 2
- local z = pos2 + height
- term.setBackgroundColor(colors[color2])
- if (hor == false) or (hor == nil) then
- terminal.fill(pos1, (pos2 - height) + 1, drawLength - 1, (height * 2) - 1)
- else
- terminal.fill(pos1, (z - 1) - moveval, length - 1, moveval + 1)
- end
- if printval == true then
- term.setCursorPos(pos1, pos2)
- term.setTextColor(colors[color3])
- if hor == true then
- if format then
- if ins >= max / 2 then
- term.setBackgroundColor(colors[color2])
- else
- term.setBackgroundColor(colors[color1])
- end
- else
- if ins >= (max / 2) - (max / height) then
- term.setBackgroundColor(colors[color2])
- else
- term.setBackgroundColor(colors[color1])
- end
- end
- elseif hor == false then
- term.setCursorPos(pos1, pos2)
- term.setTextColor(colors[color3])
- if hor == true then
- if ins >= 1 then
- term.setBackgroundColor(colors[color2])
- else
- term.setBackgroundColor(colors[color1])
- end
- end
- end
- if format then
- term.write(ins .. "/" .. max)
- term.setCursorPos(pos1, pos2 + 1)
- term.write(text)
- else
- term.write(ins .. "/" .. max .. " " .. text)
- end
- term.setBackgroundColor(oldcol)
- term.setTextColor(oldcol1)
- end
- term.setTextColor(oldcol1)
- term.setBackgroundColor(oldcol)
- end
- end
- function terminal.frame(pos1, pos2, length, height, color3, color1, thicc)
- local oldcol = term.getBackgroundColor()
- local oldcol1 = term.getTextColor()
- term.setBackgroundColor(colors[color1])
- terminal.fill(pos1 - 1, pos2 - height, length, height * 2)
- term.setBackgroundColor(oldcol)
- xm = term.getBackgroundColor()
- xb = term.getTextColor()
- term.setTextColor(xm)
- term.setBackgroundColor(xb)
- term.setCursorPos(pos1 - 1, pos2 - height)
- if thicc then
- term.setBackgroundColor(colors[color3])
- term.setTextColor(oldcol)
- term.write(string.rep("\x83", length + 1)) --\143
- term.setTextColor(xb)
- term.setBackgroundColor(xm)
- else
- term.setTextColor(oldcol)
- term.setBackgroundColor(colors[color3])
- term.write("\159" .. string.rep("\143", length - 1)) --\x83
- term.setTextColor(colors[color3])
- term.setBackgroundColor(oldcol)
- term.write("\144")
- end
- term.setCursorPos(pos1 - 1, pos2 + height)
- if thicc then
- term.setBackgroundColor(oldcol)
- term.setTextColor(colors[color3])
- term.write(string.rep("\x8f", length + 1)) --\131
- term.setBackgroundColor(colors[color1])
- term.setTextColor(colors[color3])
- else
- term.write("\130" .. string.rep("\131", length - 1) .. "\129") --\x8c
- end
- for i = 0, (height * 2) - 2 do
- if not thicc then
- term.setTextColor(xm)
- term.setBackgroundColor(xb)
- end
- term.setCursorPos(pos1 - 1, (pos2 + i) - (height) + 1)
- if thicc then
- term.setBackgroundColor(colors[color3])
- end
- term.setBackgroundColor(colors[color3])
- term.write("\x95")
- term.setCursorPos((pos1 - 2) + (length + 1), (pos2 + i) - (height) + 1)
- if not thicc then
- term.setTextColor(xb)
- term.setBackgroundColor(xm)
- end
- term.setTextColor(colors[color3])
- term.write("\x95")
- end
- term.setBackgroundColor(oldcol)
- term.setTextColor(oldcol1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement