Advertisement
goldfiction

printercheck

Aug 17th, 2023
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. -- this program check if printer have paper or ink
  2. local printer = peripheral.wrap("back")
  3.  
  4. if printer.getPaperLevel() == 0 then -- If there is no paper in the printer
  5.   error("There is no paper in the printer!")
  6. end
  7.  
  8. if printer.getInkLevel() == 0 then -- If there is no ink in the printer
  9.   error("There is no ink in the printer!")
  10. end
  11.  
  12. -- There is paper and ink in the printer, we can now print a page
  13.  
  14. -- if printer.newPage() then
  15.   -- printer.write("Tasks:")
  16.  
  17.   -- printer.setCursorPos(1, 3)
  18.   -- printer.write("* Check melon farm")
  19.  
  20.   -- printer.setCursorPos(1, 4)
  21.   -- printer.write("* Get more ender pearls")
  22.  
  23.   -- printer.setPageTitle("Tasks")
  24.   -- printer.endPage()
  25. -- else
  26.   -- error("Page could not be created.")
  27. -- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement