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