SHOW:
|
|
- or go back to the newest paste.
1 | -- Awake | |
2 | print("Chunk follow client awake: Hello World!") | |
3 | ||
4 | -- Setup wireless | |
5 | local modem = peripheral.wrap("right") | |
6 | -- 5 Server -> Client | |
7 | -- 6 Client -> Server | |
8 | - | modem.open(11) |
8 | + | modem.open(110) |
9 | - | modem.open(12) |
9 | + | modem.open(120) |
10 | - | print("Channel 11 and 12 are open") |
10 | + | print("Channel 110 and 120 are open") |
11 | ||
12 | -- Setup receiving wireless messages | |
13 | function WaitForMessage(messageCompare) | |
14 | while true do | |
15 | local a,b,c,d,e,f = os.pullEvent("modem_message") | |
16 | print("Message received: ") | |
17 | print(e) | |
18 | if(e == messageCompare) then | |
19 | print("Message accepted") | |
20 | break | |
21 | end | |
22 | end | |
23 | end | |
24 | ||
25 | -- Forward shorthand | |
26 | function Forward() | |
27 | while not turtle.forward() do | |
28 | turtle.attack() | |
29 | end | |
30 | end | |
31 | ||
32 | -- Mine loop | |
33 | while true do | |
34 | print("Waiting for start of next cycle") | |
35 | WaitForMessage("_StartNextCycle") | |
36 | print("Moving forward...") | |
37 | Forward() | |
38 | Forward() | |
39 | Forward() | |
40 | Forward() | |
41 | print(">>") | |
42 | print(">>") | |
43 | print(">>") | |
44 | end | |
45 | ||
46 | print("Goodbye >>") | |
47 | read() |