SHOW:
|
|
- or go back to the newest paste.
1 | local modem = peripheral.find("modem") or error("No modem attached", 0) | |
2 | CHANNEL = 43 | |
3 | modem.open(CHANNEL) | |
4 | ||
5 | local function receiveMessage() | |
6 | local event, _, channel, _, message = os.pullEvent("modem_message") | |
7 | if channel == CHANNEL then | |
8 | return message | |
9 | else | |
10 | print("Failed: " .. message) | |
11 | return receiveMessage() | |
12 | end | |
13 | end | |
14 | ||
15 | -- Print a line of dashes for aesthetics | |
16 | - | -- Print the welcome message |
16 | + | |
17 | - | print("Welcome to Monopoly OS by Monopoly Co.") |
17 | + | |
18 | for i = 1, width do | |
19 | - | print("Current Time: " .. textutils.formatTime(os.time(), true)) |
19 | + | |
20 | end | |
21 | io.write("\n") | |
22 | - | print("1. Bastion") |
22 | + | |
23 | - | print("2. GPS") |
23 | + | |
24 | - | print("3. Artillery Controller") |
24 | + | |
25 | - | print("4. Teleport Controller") |
25 | + | |
26 | - | print("5. Update") |
26 | + | |
27 | - | print("6. Exit") |
27 | + | |
28 | ||
29 | local function finalmessage() | |
30 | for i = 1, 99 do | |
31 | message = receiveMessage() | |
32 | clearScreen() | |
33 | - | shell.run("Bastion") |
33 | + | print("Teleporter Controller") |
34 | lineBreak() | |
35 | - | shell.run("GPS") |
35 | + | print("Programming Complete") |
36 | lineBreak() | |
37 | - | shell.run("ArtilleryControl") |
37 | + | print(message) |
38 | - | elseif choice == "4" then |
38 | + | |
39 | - | shell.run("Teleport") |
39 | + | |
40 | - | elseif choice == "5" then |
40 | + | clearScreen() |
41 | - | shell.run("Update") |
41 | + | print("Teleporter Controller") |
42 | lineBreak() | |
43 | print("Teleport Completed") | |
44 | lineBreak() | |
45 | X, Y, Z = gps.locate() | |
46 | print("Final Position: " .. X .. " " .. Y .. " " .. Z) | |
47 | end | |
48 | ||
49 | clearScreen() | |
50 | print("Teleporter Controller") | |
51 | lineBreak() | |
52 | print("Select a program to run:") | |
53 | print("1. Recall") | |
54 | print("2. Direct Teleport") | |
55 | print("3. Relative Teleport") | |
56 | print("4. Exit") | |
57 | lineBreak() | |
58 | ||
59 | local choice = read() | |
60 | ||
61 | if choice == "1" then | |
62 | clearScreen() | |
63 | print("Teleporter Controller") | |
64 | lineBreak() | |
65 | modem.transmit(15, 43, "Recall") | |
66 | print("Recall Started") | |
67 | os.sleep(1) | |
68 | finalmessage() | |
69 | elseif choice == "2" then | |
70 | clearScreen() | |
71 | print("Teleporter Controller") | |
72 | lineBreak() | |
73 | print("X: ") | |
74 | positionX = read() | |
75 | print("Y: ") | |
76 | positionY = read() | |
77 | print("Z: ") | |
78 | positionZ = read() | |
79 | ||
80 | clearScreen() | |
81 | print("Teleporter Controller") | |
82 | lineBreak() | |
83 | print("Starting Programming") | |
84 | lineBreak() | |
85 | modem.transmit(15, 43, "Teleport") | |
86 | os.sleep(1) | |
87 | modem.transmit(15, 43, positionX) | |
88 | print("X:"..positionX) | |
89 | os.sleep(1) | |
90 | modem.transmit(15, 43, positionY) | |
91 | print("Y:"..positionY) | |
92 | os.sleep(1) | |
93 | modem.transmit(15, 43, positionZ) | |
94 | print("Z:"..positionZ) | |
95 | os.sleep(1) | |
96 | ||
97 | finalmessage() | |
98 | elseif choice == "3" then | |
99 | clearScreen() | |
100 | print("Teleporter Controller") | |
101 | lineBreak() | |
102 | X, Y, Z = gps.locate() | |
103 | print("X: ") | |
104 | positionX = X + read() | |
105 | print("Y: ") | |
106 | positionY = Y + read() | |
107 | print("Z: ") | |
108 | positionZ = Z + read() | |
109 | ||
110 | clearScreen() | |
111 | print("Teleporter Controller") | |
112 | lineBreak() | |
113 | print("Starting Programming") | |
114 | lineBreak() | |
115 | modem.transmit(15, 43, "Teleport") | |
116 | os.sleep(1) | |
117 | modem.transmit(15, 43, positionX) | |
118 | print("X:"..positionX) | |
119 | os.sleep(1) | |
120 | modem.transmit(15, 43, positionY) | |
121 | print("Y:"..positionY) | |
122 | os.sleep(1) | |
123 | modem.transmit(15, 43, positionZ) | |
124 | print("Z:"..positionZ) | |
125 | os.sleep(1) | |
126 | ||
127 | finalmessage() | |
128 | end |