Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open('top')
- local printer = peripheral.wrap('right')
- local speaker = peripheral.wrap('bottom')
- function printF()
- while true do
- local rn = {rednet.receive()}
- if rn[3] == 'print' and rn[2][1] then
- local txt = rn[1]..' printed document '
- local docfile = #fs.list('files/')+1
- txt = txt..tostring(docfile)..'at ['..string.sub(os.date(),12,-6)..']'
- local file = fs.open('files/'..tostring(docfile),'w')
- file.write(rn[2])
- file = fs.open('log.txt','a')
- file.writeLine(txt)
- file.close()
- if printer.newPage() then
- speaker.playNote('harp',1,1)
- sleep(0.2)
- speaker.playNote('harp',1,1)
- local counter = 0
- for i,v in ipairs(rn[2]) do
- counter = counter + 1
- local line = nil
- if counter > 21 then
- counter = 1
- printer.endPage()
- printer.newPage()
- end
- printer.setCursorPos(1,counter)
- printer.write(v)
- end
- printer.endPage()
- end
- end
- end
- end
- function checkF()
- term.setCursorPos(1,1)
- term.clear()
- shell.run('shell')
- end
- parallel.waitForAll(printF,checkF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement