daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. osPullEvent = osPullEventRaw
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. correctid = 212
  5. rednet.open("right")
  6. rednet.send(correctid, "getturtleID")
  7. g,TurtleNetID = rednet.receive(5)
  8. TurtleNetID = TurtleNetID .. " "
  9. print("Robot Fleet #".. TurtleNetID ..)
  10. rednet.send(correctid, "New turtle at " .. gps.locate(20, false))
  11. if TurtleNetID = " " then
  12. print("Could not get TurtleNet ID, please ctrl+t and try again")
  13. end
  14. running = 1
  15. while running = 1 do
  16. while running = 1 do
  17. I,m,d = rednet.receive()
  18. if I != correctid then
  19. break
  20. end
  21. if m = TurtleNetID .. "location" then
  22. rednet.send(I, gps.locate(20, false))
  23. end
  24. if m = TurtleNetID .. "forward" then
  25. if turtle.forward() != "true" then
  26. rednet.send(I, "Error moving forwards")
  27. end
  28. end
  29. if m = TurtleNetID .. "back" then
  30. if turtle.back() != "true" then
  31. rednet.send(I, "Error moving backwards")
  32. end
  33. end
  34. if m = TurtleNetID .. "up" then
  35. if turtle.up() != "true" then
  36. rednet.send(I, "Error moving up")
  37. end
  38. end
  39. if m = TurtleNetID .. "down" then
  40. if turtle.down() != "true" then
  41. rednet.send(I, "Error moving down")
  42. end
  43. end
  44. if m = TurtleNetID .. "turn left" then
  45. turtle.turnLeft()
  46. rednet.send(I, "Turned left")
  47. end
  48. if m = TurtleNetID .. "turn right" then
  49. turtle.turnRight()
  50. rednet.send(I, "Turned right")
  51. end
  52. if m = TurtleNetID .. "dig front" then
  53. turtle.dig()
  54. rednet.send(I, "Dug front")
  55. end
  56. if m = TurtleNetID .. "dig up" then
  57. turtle.digUp()
  58. rednet.send(I, "Dug up")
  59. end
  60. if m = TurtleNetID .. "dig down" then
  61. turtle.digDown()
  62. rednet.send(I, "Dug down")
  63. end
  64. if m = TurtleNetID .. "place front" then
  65. if turtle.place() != "true" then
  66. rednet.send(I, "Error placing in front")
  67. end
  68. end
  69. if m = TurtleNetID .. "place up" then
  70. if turtle.placeUp() != "true" then
  71. rednet.send(I, "Error placing up")
  72. end
  73. if m = TurtleNetID .. "place down" then
  74. if turtle.placeDown() != "true" then
  75. rednet.send(I, "Error placing up")
  76. end
  77. end
  78. if m = TurtleNetID .. "detect front" then
  79. if turtle.detect = "true" then
  80. rednet.send(I, "Block in front")
  81. end
  82. end
  83. if m = TurtleNetID .. "detect up" then
  84. if turtle.detectUP() != "true" then
  85. rednet.send(I, "Block up")
  86. end
  87. end
  88. if m = TurtleNetID .. "detect down" then
  89. if turtle.detectDown() != "true" then
  90. rednet.send(I, "Block down")
  91. end
  92. end
  93. if m = TurtleNetID .. "spew" then
  94. turtle(drop)
  95. turtle(drop)
  96. turtle(drop)
  97. turtle(drop)
  98. turtle(drop)
  99. turtle(drop)
  100. turtle(drop)
  101. turtle(drop)
  102. turtle(drop)
  103. turtle(drop)
  104. end
  105. if m = "reset ID" then
  106. rednet.send(I, TurtleNetID)
  107. end
  108. if m = "report in" then
  109. rednet.send(I, "Turtle ID ".. TurtleNetID .. " reporting in from " gps.locate(20, false))
  110. end
  111. if m = TurtleNetID .. "terminate" then
  112. running = 0
  113. end
  114. I,m,d = 0
  115. end
  116. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top