Advertisement
Guest User

startup

a guest
Mar 5th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1.  
  2. local monitorprintcentred = function(text, side)
  3. local monitor = peripheral.wrap(side)
  4. local maxw, maxh = monitor.getSize() --screen dimensions
  5. local curx, cury = monitor.getCursorPos() --cursor pos
  6. monitor.setCursorPos((maxw-#text)/2,cury) --set it to the point where write will make the text centred
  7. monitor.write(text) --write the text
  8. monitor.setCursorPos(curx,cury+1) --return the cursor to the same position on the next line
  9. end
  10.  
  11. local monitor = peripheral.wrap("back") -- makes 'monitor' refer to the monitor on the left side
  12. local maxw, maxh =monitor.getSize() --screen dimensions
  13. monitor.setCursorPos(1,math.floor(maxh/2))--set cursor to the start of the upper middle line
  14. monitor.clear()
  15. monitorprintcentred("Welcome To","back")--print centred on that line
  16. monitorprintcentred("KizCo HQ","back")--print centred on the next line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement