SHARE
TWEET

ultitool

xmann110 Feb 11th, 2020 (edited) 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function turnLeft()
  2.     for c=1, x+3 do
  3.         turtle.dig()
  4.         turtle.forward()
  5.     end
  6.     turtle.turnLeft()
  7.     for c=1, 3+x do
  8.         turtle.dig()
  9.         turtle.forward()
  10.     end
  11. end
  12.  
  13. function turnRight()
  14.     for c=1, 3-x do
  15.         turtle.dig()
  16.         turtle.forward()
  17.     end
  18.     turtle.turnLeft()
  19.     for c=1, 3-x do
  20.         turtle.dig()
  21.         turtle.forward()
  22.     end
  23. end
  24.  
  25. function forward()
  26.     turtle.dig()
  27.     turtle.forward()
  28. end
  29.  
  30. function up()
  31.     while true do
  32.         if turtle.detectUp() then
  33.             a, b = turtle.inspectUp()
  34.             if not (b.name == "ComputerCraft:CC-Turtle") then
  35.                 turtle.digUp()
  36.                 break
  37.             end
  38.         else
  39.             break
  40.         end
  41.     end
  42.     turtle.up()
  43. end
  44.  
  45. function down()
  46.     while true do
  47.         if turtle.detectDown() then
  48.             a, b = turtle.inspectDown()
  49.             if not (b.name == "ComputerCraft:CC-Turtle") then
  50.                 turtle.digDown()
  51.                 break
  52.             end
  53.         else
  54.             break
  55.         end
  56.     end
  57.     turtle.down()
  58. end
  59.  
  60. if turtle then
  61.     rednet.open("right")
  62.  
  63.     print("Awaiting identification")
  64.  
  65.     source, x = rednet.receive()
  66.     source, y = rednet.receive()
  67.  
  68.     print("I am turtle (" .. tostring(x) .. ", " .. tostring(y) .. ")")
  69.  
  70.     turtle.select(1)
  71.     turtle.suckUp(64)
  72.     turtle.refuel(64)
  73.  
  74.     turtle.forward()
  75.     turtle.forward()
  76.     turtle.up()
  77.     turtle.up()
  78.     turtle.up()
  79.     turtle.up()
  80.  
  81.     if not (x == 0) then
  82.         if x > 0 then
  83.             turtle.turnLeft()
  84.             print("going left")
  85.         else
  86.             turtle.turnRight()
  87.             print("going right")
  88.         end
  89.  
  90.         for c=1, math.abs(x) do
  91.             turtle.forward()
  92.             print("weee")
  93.         end
  94.         if x > 0 then
  95.             turtle.turnRight()
  96.             print("return")
  97.         else
  98.             turtle.turnLeft()
  99.             print("return")
  100.         end
  101.     end
  102.  
  103.     for c=0, 3-y do
  104.         turtle.up()
  105.     end
  106.     turtle.up()
  107.  
  108.     while true do
  109.         a, b = rednet.receive()
  110.         if b == "forward" then
  111.             forward()
  112.         end
  113.         if b == "right" then
  114.             turnRight()
  115.         end
  116.         if b == "left" then
  117.             turnLeft()
  118.         end
  119.         if b == "up" then
  120.             up()
  121.         end
  122.         if b == "down" then
  123.             down()
  124.         end
  125.     end
  126. 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