Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitorSide = "back"
- if peripheral.isPresent(monitorSide) and peripheral.getType(monitorSide) == "monitor" then
- term.redirect(peripheral.wrap(monitorSide))
- peripheral.wrap(monitorSide).setTextScale(1)
- else
- print("No monitor found")
- return
- end
- function explode(inSplitPattern, str)
- str = str .. ""
- local outResults = {}
- local theStart = 1
- local theSplitStart, theSplitEnd = string.find(str, inSplitPattern, theStart)
- while theSplitStart do
- local sub = string.sub(str, theStart, theSplitStart - 1)
- table.insert(outResults, sub)
- theStart = theSplitEnd + 1
- theSplitStart, theSplitEnd = string.find(str, inSplitPattern, theStart)
- end
- table.insert(outResults, string.sub(str, theStart))
- return outResults
- end
- function printColouredBars(str, first)
- parts = explode("|", str)
- local l = #parts
- for k = 1, l do
- if first then
- term.setTextColor(colors.blue)
- end
- io.write(parts[k])
- if first then
- term.setTextColor(colors.white)
- end
- if k ~= l then
- term.setTextColor(colors.red)
- io.write("|")
- term.setTextColor(colors.white)
- end
- end
- end
- function profile()
- term.setCursorPos(1, 1)
- local success, output = commands.exec("tickprofilertps")
- --local text = table.concat(output, "\n")
- term.clear()
- for i, line in ipairs(output) do
- if i == 1 then
- term.setTextColor(colors.blue)
- else
- if i == 2 then
- term.setTextColor(colors.white)
- else
- if i == #output then
- term.setTextColor(colors.lime)
- else
- if i == #output - 1 then
- term.setTextColor(colors.orange)
- else
- term.setTextColor(colors.lightGray)
- end
- end
- end
- end
- print(line)
- end
- end
- while true do
- profile()
- sleep(0.5)
- end
- term.restore()
Add Comment
Please, Sign In to add comment