Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sender = 1
- shell.run('clear')
- rednet.open("left")
- local function tryDown()
- while not turtle.down() do
- turtle.digDown()
- return "Dig Down"
- end
- return true
- end
- local function tryUp()
- while not turtle.up() do
- turtle.digUp()
- return "Dig Up"
- end
- return true
- end
- local function tryInspect()
- local obj, thing = turtle.inspect()
- if obj then return thing.name end
- return "Air"
- end
- local actions = {}
- actions["forward"] = turtle.forward
- actions["backward"] = turtle.back
- actions["left"] = turtle.turnLeft
- actions["right"] = turtle.turnRight
- actions["up"] = tryUp
- actions["down"] = tryDown
- actions["dig"] = turtle.dig
- actions["place"] = turtle.place
- actions["inspect"] = tryInspect
- while true do
- local action, senderID, text = os.pullEvent("rednet_message")
- if actions[text] then
- local a, b, c = actions[text]()
- rednet.send(1, a)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment