SHOW:
|
|
- or go back to the newest paste.
1 | write('Host ID: ') | |
2 | sender = read() | |
3 | --ask for host id | |
4 | ||
5 | shell.run('clear') --clear the screen | |
6 | rednet.open("right") --open the wifi port | |
7 | x=1 | |
8 | while x == 1 do --start loop | |
9 | action, senderID, text = os.pullEvent() --wait for input | |
10 | if action == "rednet_message" then --if its a wireless message do | |
11 | if text == 'forward' then -- if the up button is pressed | |
12 | turtle.forward() -- go forward | |
13 | end | |
14 | if text == 'backward' then --you know... | |
15 | turtle.back() | |
16 | end | |
17 | if text == 'left' then | |
18 | turtle.turnLeft() | |
19 | end | |
20 | if text == 'right' then | |
21 | turtle.turnRight() | |
22 | end | |
23 | if text == 'up' then | |
24 | if turtle.detectUp() then | |
25 | turtle.digUp() | |
26 | else | |
27 | turtle.up() | |
28 | end | |
29 | end | |
30 | if text == 'down' then | |
31 | if turtle.detectDown() then | |
32 | turtle.digDown() | |
33 | else | |
34 | turtle.down() | |
35 | end | |
36 | end | |
37 | ||
38 | ||
39 | ||
40 | if text == 'dig' then -- if the space button is pressed on dig mode | |
41 | turtle.dig() -- dig forward | |
42 | end | |
43 | if text == 'place' then -- if the space button is pressed on place mode | |
44 | turtle.place() --place the selected block in front | |
45 | end | |
46 | if text == 'rs' then -- if the ctrl button is pressed | |
47 | redstone.setOutput('front', true) -- set redstone in front to true | |
48 | end | |
49 | end | |
50 | if action=="key" and senderID == sender then -- check sender id | |
51 | x=0 | |
52 | end | |
53 | end |