Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --variables
- ctrlid = 3
- slot = 1
- --functions
- function command(msg)
- local h = fs.open("temp", "w")
- h.write(msg)
- h.close()
- shell.run("temp")
- fs.delete("temp")
- end
- function pm(msg)
- print("<-- "..tostring(msg))
- end
- --body
- rednet.open("left")
- relay = true
- while relay do
- id, msg = rednet.receive()
- if id == ctrlid then
- pm(msg)
- if msg == "lCtrl" then
- relay = false
- term.clear()
- term.setCursorPos(1, 1)
- elseif msg == "w" then
- turtle.forward()
- elseif msg == "s" then
- turtle.back()
- elseif msg == "a" then
- turtle.turnLeft()
- elseif msg == "d" then
- turtle.turnRight()
- elseif msg == "space" then
- turtle.up()
- elseif msg == "lShift" then
- turtle.down()
- elseif msg == "e" then
- turtle.equipRight()
- elseif msg == "f" then
- turtle.dig()
- elseif msg == "g" then
- turtle.place()
- elseif msg == "q" then
- idA, msgA = rednet.receive()
- if idA == ctrlid then
- for i = 1, 16 do
- if i == tonumber(msgA) then
- slot = tonumber(msgA)
- end
- end
- turtle.select(slot)
- print("<< "..tostring(slot))
- end
- elseif msg == "r" then
- idB, msgB = rednet.receive()
- if idB == ctrlid then
- command(msgB)
- print("<< "..msgB)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement