SHARE
TWEET

Untitled

a guest Oct 13th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local monitorprintcentred = function(text, side)
  2. local monitor = peripheral.wrap(side)
  3. local maxw, maxh = monitor.getSize() --screen dimensions
  4. local curx, cury = monitor.getCursorPos() --cursor pos
  5.  
  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("left") -- 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.  
  15. monitorprintcentred("ATM","back")--print centred on that line
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top