Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- argument handling
- args = {...}
- tInput = tostring(args[1])
- 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(1)
- while monSizeX < tInput do
- tScale = tScale - 0.1
- monitor.setTextScale(tScale)
- print("trying ", tostring(tScale))
- end
- monCenterX = monSizeX / 2
- monCenterY = monSizeY / 2
- if tSecond then
- while monSizeY < tSecond do
- tScale = tScale - 0.1
- monitor.setTextScale(tScale)
- print("trying ", tostring(tScale))
- end
- -- two lines
- -- line one prep
- monitor.setCursorPos(monCenterX - #tInput, monCenterY - 1)
- -- write
- monitor.write(tInput)
- -- line two prep
- monitor.setCursorPos(monCenterX - #tSecond, monCenterY)
- -- write
- monitor.write(tSecond)
- else
- -- single line prep
- monitor.setCursorPos(monCenterX - #tInput, monCenterY)
- end
- monitor.write()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement