Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- argument handling
- args = {...}
- tInput = tostring(args[1])
- tSecond = "nanburger"
- tSecond = tostring(args[2])
- -- find monitor
- local monitor = peripheral.find("monitor")
- -- prepare monitor
- monitor.setBackgroundColor(colors.purple)
- monitor.setTextColor(colors.cyan)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.setTextScale(2)
- monSizeX = monitor.getSize(1)
- monSizeY = monitor.getSize(2)
- tScale = 2
- while monSizeX - 1 < #tInput do
- tScale = tScale - 0.1
- monitor.setTextScale(tScale)
- monSizeX = monitor.getSize(1)
- monSizeY = monitor.getSize(2)
- print("trying ", tostring(tScale))
- end
- monCenterX = math.ceil(monSizeX / 2)
- monCenterY = math.ceil(monSizeY / 2)
- if args[2] then
- print("not nil")
- while monSizeY - 1 < #tSecond do
- tScale = tScale - 0.1
- monitor.setTextScale(tScale)
- monSizeX = monitor.getSize(1)
- monSizeY = monitor.getSize(2)
- print("trying ", tostring(tScale))
- end
- monCenterX = math.ceil(monSizeX / 2)
- monCenterY = math.ceil(monSizeY / 2)
- -- two lines
- -- line one prep
- monitor.setCursorPos(monCenterX - math.floor(#tInput / 2), monCenterY - 1)
- -- write
- monitor.write(tInput)
- -- line two prep
- monitor.setCursorPos(monCenterX - math.floor(#tSecond / 2), monCenterY)
- -- write
- monitor.write(tSecond)
- else
- -- single line prep
- monitor.setCursorPos(monCenterX - math.floor(#tInput / 2), monCenterY)
- monitor.write(tInput)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement