Advertisement
Rolcam

Computercraft - Condemned Mall Document Printer

Feb 23rd, 2024 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.16 KB | None | 0 0
  1. printer = peripheral.wrap("bottom")
  2.  
  3. loop = 1
  4.  
  5. while loop == 1 do
  6.     term.clear()
  7.     term.setCursorPos(1,1)
  8.     print("Please select the document number you would like to print:\n ")
  9.     print("1 - Price Quote")
  10.     print("2 - Invoice")
  11.     print("3 - Receipt")
  12.     print("4 - Letter")
  13.     print("5 - Redaction")
  14.     input = tonumber(read())
  15.     if (input == nil) or (input > 5) then
  16.         print("Invalid Option, please try again")
  17.         sleep(2)
  18.     else
  19.         loop = 0
  20.     end
  21. end
  22.  
  23. if input == 1 then
  24.     -- Quote
  25.     print("Please insert purple dye for pre-print")
  26.     print("Press the enter key when done")
  27.     read()
  28.     printer.newPage()
  29.     printer.setPageTitle("Condemned Mall Ad Agency - Quote")
  30.     printer.setCursorPos(1,1)
  31.     printer.write("Condemned Mall Ad Agency")
  32.     printer.setCursorPos(1,3)
  33.     printer.write("Services Price Quote:")
  34.     for i = 4, 13 do
  35.         printer.setCursorPos(1,i)
  36.         printer.write("                  | $    ")
  37.     end
  38.     printer.setCursorPos(1,14)
  39.     printer.write("Total: $")
  40.     printer.setCursorPos(1,15)
  41.     printer.write("Quoted for:")
  42.     printer.setCursorPos(1,17)
  43.     printer.write("Quoted by:")
  44.     printer.setCursorPos(1,19)
  45.     printer.write("Quote ID:")
  46.     printer.setCursorPos(1,20)
  47.     printer.write("Quotes don't expire")
  48.     printer.setCursorPos(1,21)
  49.     printer.write("Thanks for choosing us!")
  50.     printer.endPage()
  51.     print("Please reinsert page and black ink")
  52.     print("Press the enter key when done:")
  53.     read()
  54.     term.clear()
  55.     term.setCursorPos(1,1)
  56.     loop2 = 1
  57.     total = 0
  58.     printer.newPage()
  59.     -- Price Quote Items
  60.     for i = 1, 10 do
  61.         print("Please enter line item " .. i .. "/10")
  62.         print("------------------")
  63.         printer.setCursorPos(1, (i + 3))
  64.         printer.write(read())
  65.         print("Please enter price for item " .. i .. "/10")
  66.         print("Do not include the $ or commas!")
  67.         print("----")
  68.         printer.setCursorPos(22, (i + 3))
  69.         input2 = read()
  70.         printer.write(input2)
  71.         if tonumber(input2) == nil then
  72.             input2 = 0
  73.         end
  74.         total = total + tonumber(input2)
  75.     end
  76.     printer.setCursorPos(9,14)
  77.     printer.write(total)
  78.     print("Please enter the customer's username:")
  79.     cName = read()
  80.     printer.setCursorPos(1,16)
  81.     printer.write(cName)
  82.     print("Please enter your username:")
  83.     yName = read()
  84.     printer.setCursorPos(1,18)
  85.     printer.write(yName)
  86.     print("Please create an ID for this Quote")
  87.     ID = read()
  88.     printer.setCursorPos(10,19)
  89.     printer.write(ID)
  90.     printer.endPage()
  91.     print("Quote printed!")
  92. elseif input == 2 then
  93.     -- Invoice/Bill
  94.     print("Please insert orange dye for pre-print")
  95.     print("Press the enter key when done")
  96.     read()
  97.     printer.newPage()
  98.     printer.setPageTitle("Condemned Mall Ad Agency - Invoice")
  99.     printer.setCursorPos(1,1)
  100.     printer.write("Condemned Mall Ad Agency")
  101.     printer.setCursorPos(1,3)
  102.     printer.write("Service Invoice:")
  103.     for i = 4, 13 do
  104.         printer.setCursorPos(1,i)
  105.         printer.write("                  | $    ")
  106.     end
  107.     printer.setCursorPos(1,14)
  108.     printer.write("Total: $")
  109.     printer.setCursorPos(1,15)
  110.     printer.write("Invoice for:")
  111.     printer.setCursorPos(1,17)
  112.     printer.write("Please pay promptly")
  113.     printer.setCursorPos(1,20)
  114.     printer.write("Thanks for choosing the")
  115.     printer.setCursorPos(1,21)
  116.     printer.write("Condemned Mall Ad Agency")
  117.     printer.endPage()
  118.     print("Please reinsert page and black ink")
  119.     print("Press the enter key when done:")
  120.     read()
  121.     term.clear()
  122.     term.setCursorPos(1,1)
  123.     loop2 = 1
  124.     total = 0
  125.     printer.newPage()
  126.     -- Invoiced Items
  127.     for i = 1, 10 do
  128.         print("Please enter line item " .. i .. "/10")
  129.         print("------------------")
  130.         printer.setCursorPos(1, (i + 3))
  131.         printer.write(read())
  132.         print("Please enter price for item " .. i .. "/10")
  133.         print("Do not include the $ or commas!")
  134.         print("----")
  135.         printer.setCursorPos(22, (i + 3))
  136.         input2 = read()
  137.         printer.write(input2)
  138.         if tonumber(input2) == nil then
  139.             input2 = 0
  140.         end
  141.         total = total + tonumber(input2)
  142.     end
  143.     printer.setCursorPos(9,14)
  144.     printer.write(total)
  145.     print("Please enter the customer's username:")
  146.     cName = read()
  147.     printer.setCursorPos(1,16)
  148.     printer.write(cName)
  149.     printer.endPage()
  150.     print("Invoice printed!")
  151. elseif input == 3 then
  152.     -- Payment Receipts
  153.     print("Please insert green dye for pre-print")
  154.     print("Press the enter key when done")
  155.     read()
  156.     printer.newPage()
  157.     printer.setPageTitle("Condemned Mall Ad Agency - Receipt")
  158.     printer.setCursorPos(1,1)
  159.     printer.write("Condemned Mall Ad Agency")
  160.     printer.setCursorPos(1,3)
  161.     printer.write("Payment Receipt:")
  162.     for i = 4, 13 do
  163.         printer.setCursorPos(1,i)
  164.         printer.write("                  | $    ")
  165.     end
  166.     printer.setCursorPos(1,14)
  167.     printer.write("Total: $")
  168.     printer.setCursorPos(1,15)
  169.     printer.write("Receipt for:")
  170.     printer.setCursorPos(1,17)
  171.     printer.write("Paid in full")
  172.     printer.setCursorPos(1,20)
  173.     printer.write("Thanks for choosing the")
  174.     printer.setCursorPos(1,21)
  175.     printer.write("Condemned Mall Ad Agency")
  176.     printer.endPage()
  177.     print("Please reinsert page and black ink")
  178.     print("Press the enter key when done:")
  179.     read()
  180.     term.clear()
  181.     term.setCursorPos(1,1)
  182.     loop2 = 1
  183.     total = 0
  184.     printer.newPage()
  185.     -- Receipt Items
  186.     for i = 1, 10 do
  187.         print("Please enter line item " .. i .. "/10")
  188.         print("------------------")
  189.         printer.setCursorPos(1, (i + 3))
  190.         printer.write(read())
  191.         print("Please enter price for item " .. i .. "/10")
  192.         print("Do not include the $ or commas!")
  193.         print("----")
  194.         printer.setCursorPos(22, (i + 3))
  195.         input2 = read()
  196.         printer.write(input2)
  197.         if tonumber(input2) == nil then
  198.             input2 = 0
  199.         end
  200.         total = total + tonumber(input2)
  201.     end
  202.     printer.setCursorPos(9,14)
  203.     printer.write(total)
  204.     print("Please enter the customer's username:")
  205.     cName = read()
  206.     printer.setCursorPos(1,16)
  207.     printer.write(cName)
  208.     printer.endPage()
  209.     print("Receipt printed!")
  210. elseif input == 4 then
  211.      -- Custom Leter
  212.     print("Please insert red dye for pre-print")
  213.     print("Press the enter key when done")
  214.     read()
  215.     printer.newPage()
  216.     printer.setPageTitle("Condemned Mall Ad Agency Letter")
  217.     printer.setCursorPos(1,1)
  218.     printer.write("    Letter from the    ")
  219.     printer.setCursorPos(1,2)
  220.     printer.write("Condemned Mall Ad Agency")
  221.     printer.endPage()
  222.     print("Please reinsert page and black ink")
  223.     print("Press the enter key when done:")
  224.     read()
  225.     term.clear()
  226.     term.setCursorPos(1,1)
  227.     loop2 = 1
  228.     total = 0
  229.     printer.newPage()
  230.     print("Please write your opening:")
  231.     print("------------------------")
  232.     input = read()
  233.     printer.setCursorPos(1,4)
  234.     printer.write(input)
  235.     -- Price Quote Items
  236.     for i = 6, 18 do
  237.         print("Please write your letter:")
  238.         print("Line " .. (i - 5) .. "/13")
  239.         print("------------------------")
  240.         printer.setCursorPos(1, i)
  241.         printer.write(read())
  242.     end
  243.     print("Please write your closing:")
  244.     print("------------------------")
  245.     printer.setCursorPos(1,20)
  246.     printer.write(read())
  247.     print("Please write your username:")
  248.     print("------------------------")
  249.     printer.setCursorPos(1,21)
  250.     printer.write(read())
  251.     printer.endPage()
  252.     print("Letter printed!")
  253. elseif input == 5 then
  254.     print("Please enter paper to be readacted and ink of choice")
  255.     print("Press the enter key when done:")
  256.     read()
  257.     printer.newPage()
  258.     for i = 1, 21 do
  259.         printer.setCursorPos(1,i)
  260.         printer.write("------------------------")
  261.     end
  262.     printer.setPageTitle("Redacted")
  263.     printer.endPage()
  264.     print("Document redacted!")
  265. else
  266.     printer.newPage()
  267.     printer.setCursorPos(1,1)
  268.     printer.write("Warning: Invalid Option")
  269.     printer.endPage()
  270. end
  271.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement