SHOW:
|
|
- or go back to the newest paste.
1 | - | c = require("component") |
1 | + | c = require("component") |
2 | - | e = require("event") |
2 | + | e = require("event") |
3 | - | t = require("term") |
3 | + | t = require("term") |
4 | - | local m = c.modem |
4 | + | local m = c.modem |
5 | - | |
5 | + | |
6 | - | s = c.getPrimary("stargate") |
6 | + | s = c.getPrimary("stargate") |
7 | - | |
7 | + | |
8 | - | t.clear() |
8 | + | t.clear() |
9 | - | |
9 | + | |
10 | - | while true do |
10 | + | while true do |
11 | - | print(e.pull("sgDialIn")) |
11 | + | print(e.pull("sgDialIn")) |
12 | - | print("Incoming Wormhole") |
12 | + | print("Incoming Wormhole") |
13 | - | print("Closing Iris") |
13 | + | print("Closing Iris") |
14 | - | s.closeIris() |
14 | + | s.closeIris() |
15 | - | m.open(420) --- Choose whatever port you want |
15 | + | m.open(420) --- Choose whatever port you want |
16 | - | print("Channel Open") |
16 | + | print("Channel Open") |
17 | - | e.pull("sgStargateStateChange") |
17 | + | e.pull("sgStargateStateChange") |
18 | - | print("Awaiting Signal") |
18 | + | print("Awaiting Signal") |
19 | - | local _, _, from, port, _, message = e.pull("modem_message") |
19 | + | local _, _, from, port, _, message = e.pull("modem_message") |
20 | - | if message == "12345" then --- choose whatever password you want |
20 | + | if message == "12345" then --- choose whatever password you want |
21 | - | print("Code Accpeted, Opening Iris") |
21 | + | print("Code Accpeted, Opening Iris") |
22 | - | s.openIris() |
22 | + | s.openIris() |
23 | - | os.sleep(2) |
23 | + | os.sleep(2) |
24 | - | m.broadcast(420, "Iris Open") --- port must be the same as the one you chose earlier |
24 | + | m.broadcast(420, "Iris Open") --- port must be the same as the one you chose earlier |
25 | - | print("Welcome Home") |
25 | + | print("Welcome Home") |
26 | - | os.sleep(10) |
26 | + | os.sleep(10) |
27 | - | print("Closing Gate") |
27 | + | print("Closing Gate") |
28 | - | s.disconnect() |
28 | + | s.disconnect() |
29 | - | else if message ~= "12345" then ---password must be the same as the one you chose earlier |
29 | + | else if message ~= "12345" then ---password must be the same as the one you chose earlier |
30 | - | m.broadcast(420, "Code Rejected") --- port must be the same as the one you chose earlier |
30 | + | m.broadcast(420, "Code Rejected") --- port must be the same as the one you chose earlier |
31 | - | print("Code: " ..(message).." Not Accepted, Disconnecting Gate") |
31 | + | print("Code: " ..(message).." Not Accepted, Disconnecting Gate") |
32 | - | s.disconnect() |
32 | + | s.disconnect() |
33 | - | e.pull("sgStargateStateChange") |
33 | + | e.pull("sgStargateStateChange") |
34 | - | os.sleep(1) |
34 | + | os.sleep(1) |
35 | - | print("Gate Disconnected, Opening Iris") |
35 | + | print("Gate Disconnected, Opening Iris") |
36 | - | s.openIris() |
36 | + | s.openIris() |
37 | - | print("Good-Bye") |
37 | + | print("Good-Bye") |
38 | - | end |
38 | + | end |
39 | - | end |
39 | + | end |
40 | end |