Advertisement
Guest User

Printer ComputerCraft Program

a guest
Nov 8th, 2013
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. p = peripheral.wrap("right") --you could change the side to what ever you like
  2.  
  3. ink = p.getInkLevel() --get ink level from printer
  4. paper = p.getPaperLevel() --get paper level from printer
  5.  
  6. if ink > 0 and paper > 0 then
  7. line = 1 --sets line to 1
  8. while true do --main loop
  9. input = io.read() --reads your input
  10. if input == "exit()" then --if input is exit() it will stop adding text to the file
  11. p.endPage()
  12. break
  13. else
  14. print("text for line " ..line..":")
  15. p.write(input) --writes the input to to paper
  16. line = line + 1 --adds 1 to line
  17. p.setCursorPos(1,line) --moves the cursor(position where you are going to write) 1 down
  18. end
  19. end
  20. else
  21. print("fill the printer with ink and paper please")
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement