Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.find("monitor")
- local Xpos = 5
- local Ypos = 5
- local Xend = 30
- local Yend = 8
- local Yfill = 0
- function fill(text)
- mon.setBackgroundColor(colors.blue)
- local yspot = math.floor((Ypos+Yend)/2)
- local xspot = math.floor((Xend-Xpos-string.len(text))/2)+1
- for j = Ypos,Yend do
- mon.setCursorPos(Xpos, j)
- if j == yspot then
- local xspot2 = math.floor((Xend-Xpos-string.len(text))/2)+1
- for k = 0, xspot2 do
- if k == xspot then
- mon.write(text)
- else
- mon.write(" ")
- end
- end
- else
- for i = Xpos, Xend do
- mon.write(" ")
- end
- end
- end
- mon.setBackgroundColor(colors.black)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement