Advertisement
craftyoyo

print

Aug 19th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. write "Welcome to Notepad"
  2. sleep(1)
  3. term.setCursorPos(1,1)
  4. term.clearLine()
  5. --this is getting rid of that line that we no longer need
  6. sleep(1)
  7. --this is getting the user typeing
  8. write "you may start typing. when you are done please push 'end' to print"
  9. function notepad()
  10. x = io.read()
  11. --now this is going to get the users keyboard button press p.s. i wanted it to be the end key
  12. if event == "char" and param1 == "end" then
  13. sleep(1)
  14. print "which side is your printer on"
  15. c = io.read()
  16. local printer=perhipheral.wrap(c)
  17. end
  18. --print start
  19. -- this is to see if the printer is out of ink or paper
  20. if printer.getInkLevel()==0 then
  21.    write "No Ink! Add Some More To Print"
  22.    while printer.getInkLevel()==o do
  23.                  os.sleep(.5)
  24. end
  25. if printer.getPaperLevel()==0 then
  26.    write "No Paper! add some more please"
  27.    while printer.getPaperLevel()==0 do
  28.                  os.sleep(.5)
  29. end
  30. --print end
  31. -- this is where the printer starts the print
  32. --print start
  33. printer.newPage()
  34. sleep(1)
  35. m = io.read()
  36. if m == "yes" then
  37. title()
  38. printer.write(x)
  39. printer.setCursorPos(1,2)
  40. local w, h=printer.getPageSize()
  41. printer.setCursorPos(1,h)
  42.  
  43.  
  44. local str="Vertical"
  45. for i=1,#str do
  46.    printer.setCursorPos(w.i
  47.    printer.write(string.sub(str,i,i))
  48. elseif m == "no" then
  49. notepad()
  50. end
  51. --print end
  52. -- this asks if the user wants to add a title
  53. write "would you like to add a title to show in inventory"
  54. i = io.read()
  55. if i == "yes" then
  56. write "what should it be"
  57. o = io.read()
  58. funcion title()
  59. printer.setPageTitle(o)
  60. end
  61. elseif i == "no" then
  62. printer.endPage()
  63. end
  64. sleep(1)
  65. write "your document is finished"
  66. term.clear()
  67. --parts of the code where the comment "print"
  68. --was a part of the printer tutorial made by"GopherAtl"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement