os.pullEvent = os.pullEventRaw local redin = "right" local redout = "bottom" local printerside = "left" math.randomseed(os.time()) local printer = peripheral.wrap(printerside) -- Wrap the printer local stopme = true local result, n1, n2, n3, hash, ready while (true) do ready = printer.newPage() n1 = math.random(20) n2 = math.random(20) n3 = math.random(20) hash = (n1*n2*n3*541)%(n1+n2+n3+29) --10th and 100th primes result = n1 .. " " .. n2 .. " " .. n3 .. "\nHash Code: " .. hash write("Your lotto numbers are!\n" .. result .. "\n\nMake sure you grab your ticket.\n\n") if ready then printer.write(result) printer.setPageTitle("Lotto Ticket") printer.endPage() redstone.setOutput(redout, true) sleep(10) redstone.setOutput(redout, false) else error("Could not create a page. Is there any paper and ink in the printer?\n") end shell.run("clear") write("Press enter for your ticket!\n\n") result = read() end