SHOW:
|
|
- or go back to the newest paste.
1 | -- Configuration. | |
2 | - | local modemSide = "back" -- Which side is the modem on? |
2 | + | local modemSide = "top" -- Which side is the modem on? |
3 | local printerSide = "right" -- Which side is the printer on? | |
4 | local securityCode = "9513" -- Security code, exactly 4 characters! | |
5 | -- End Configuration. | |
6 | - | print("Computer Address: ") |
6 | + | |
7 | - | local input = read() |
7 | + | |
8 | - | rednet.send(tonumber(input), os.getComputerID()) |
8 | + | print("Standing by to receive document.") |
9 | - | print("Standing by to receive site...") |
9 | + | |
10 | local blah,data = rednet.receive() | |
11 | if(string.find(data, securityCode)) then | |
12 | - | if(string.find(data, input)) then |
12 | + | use = string.sub(data, 5) |
13 | - | use = string.sub(data, (string.len(input) + 1)) |
13 | + | print("Data received. Printing...") |
14 | - | print(use) |
14 | + | printer = peripheral.wrap(printerSide) |
15 | - | if(fs.exists("site")) then |
15 | + | printer.newPage() |
16 | - | fs.delete("site") |
16 | + | printer.setPageTitle("Classified") |
17 | local line = 1 | |
18 | - | local file = fs.open("site", "w") |
18 | + | local value = (string.len(use) / 25) + 1 |
19 | - | file.write(use) |
19 | + | while line < value do |
20 | - | file:close() |
20 | + | printer.setCursorPos(1, line) |
21 | - | shell.run("site") |
21 | + | printer.write(string.sub(use, 25 * (line - 1) + 1, (line + 1) * 25)) |
22 | - | fs.delete("site") |
22 | + | os.sleep(.01) |
23 | - | break |
23 | + | line = line + 1 |
24 | end | |
25 | - | end |
25 | + | printer.endPage() |
26 | - | fs.delete("site") |
26 | + | print("Document Complete.") |
27 | end | |
28 | end |