Advertisement
Guest User

turtle

a guest
Jul 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. function RCslave()
  2. while true do
  3. local scrap, message = rednet.receive()
  4. if message == "TS Forward" then
  5. print("Forward")
  6. if turtle.detect() == true then
  7. turtle.dig()
  8. end
  9. turtle.forward()
  10. elseif message == "TS Backward" then
  11. print("Backward")
  12. turtle.back()
  13. elseif message == "TS PlaceDown" then
  14. turtle.placeDown()
  15. elseif message == "TS PlaceUp" then
  16. turtle.placeUp()
  17. elseif message == "TS TurnLeft" then
  18. print("Turn Left")
  19. turtle.turnLeft()
  20. elseif message == "TS Down" then
  21. if turtle.detectDown() then
  22. turtle.digDown()
  23. turtle.down()
  24. else
  25. turtle.down()
  26. end
  27. elseif message == "TS Up" then
  28. if turtle.detectUp() then
  29. turtle.digUp()
  30. turtle.up()
  31. else
  32. turtle.up()
  33. end
  34. elseif message == "TS TurnRight" then
  35. print("Turn Right")
  36. turtle.turnRight()
  37. elseif message == "TS PlaceBlock" then
  38. if turtle.detect() == true then
  39. print("Block Present")
  40. else
  41. print("Place Block")
  42. turtle.place()
  43. end
  44. end
  45. end
  46. end
  47. rednet.open("right")
  48. textutils.slowPrint("TurtleReceive Initiated.")
  49. RCslave()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement