SHOW:
|
|
- or go back to the newest paste.
1 | --opening rednet modem | |
2 | rednet.open("left") | |
3 | --wraping the top monitor | |
4 | mon = peripheral.find("monitor_") | |
5 | term.setCursorPos(1,1) | |
6 | term.clear() | |
7 | term.setBackgroundColor(colors.yellow) | |
8 | ||
9 | - | function clearset() |
9 | + | |
10 | while true do | |
11 | ||
12 | --waiting to receive a message from the server (server > client transfer) | |
13 | prot,id,msg = os.pullEvent("rednet_message") | |
14 | ||
15 | if id == 3 then | |
16 | ||
17 | if msg ~= "alarm" then | |
18 | ||
19 | term.clear() | |
20 | term.setCursorPos(1,1) | |
21 | mon.clear() | |
22 | mon.setCursorPos(1,1) | |
23 | mon.setTextColor(colors.white) | |
24 | mon.write("Welcome "..msg) | |
25 | - | clearset() |
25 | + | |
26 | mon.write("Have a great Day") | |
27 | sleep(4) | |
28 | term.clear() | |
29 | term.setCursorPos(1,1) | |
30 | mon.clear() | |
31 | - | clearset() |
31 | + | |
32 | else | |
33 | ||
34 | term.clear() | |
35 | - | clearset() |
35 | + | |
36 | mon.clear() | |
37 | mon.setCursorPos(1,1) | |
38 | mon.setTextColor(colors.red) | |
39 | mon.write("Intruder Alert!") | |
40 | rs.setOutput("right",true) | |
41 | prot,id,msg = os.pullEvent("rednet_message") | |
42 | ||
43 | - | clearset() |
43 | + | |
44 | ||
45 | term.clear() | |
46 | term.setCursorPos(1,1) | |
47 | mon.clear() | |
48 | mon.setCursorPos(1,1) | |
49 | rs.setOutput("right",false) | |
50 | os.reboot() | |
51 | else | |
52 | print("error") | |
53 | ||
54 | else | |
55 | ||
56 | print(":Warning: Unauthorized transmission has been received") | |
57 | ||
58 | ||
59 | ||
60 | end | |
61 | end | |
62 | end | |
63 | end |