Advertisement
TJtheDJ701

Untitled

Sep 27th, 2021
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1.  
  2.  
  3. term.clear()
  4.  
  5. local printcentred =
  6. function(text)
  7. local maxw, maxh = term.getSize() --screen dimensions
  8. local curx, cury = term.getCursorPos() --cursor pos
  9. term.setCursorPos((maxw-#text)/2,cury) --set it to the point where write will make the text centred
  10. term.write(text) --write the text
  11. term.setCursorPos(curx,cury+1) --return the cursor to the same position on the next line
  12. end
  13. local maxw, maxh = term.getSize() --screen dimensions
  14. term.setCursorPos(1,math.floor(maxh/2))--set cursor to the start of the upper middle line
  15. printcentred("Welcome To")--print centred on that line
  16. printcentred("Server Name")--print centred on the next line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement