Guest User

gather

a guest
Dec 17th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local dif = 25
  2. local rec = 31
  3.  
  4. rednet.open("right")
  5. rednet.send(rec,"Gathering items!")
  6. rednet.send(rec,"Heading up... ")
  7. write("Heading up... ")
  8.  
  9. function down()
  10.   write("Heading down... ")
  11.   rednet.send(rec, "Heading down...")
  12.   local count = 0
  13.   while not turtle.detectDown() do
  14.     count = count + 1
  15.     if count % dif == 0 then
  16.       rednet.send(rec,"Progress: "..count.." blocks!")
  17.     end
  18.     count2 = 0
  19.     while not turtle.down() do
  20.       if not turtle.digDown() then
  21.         if not turtle.attackDown() then
  22.           count2 = count2 + 1
  23.           if count2 % dif == 0 then
  24.             print("Failed!")
  25.             rednet.send(rec,"Failed!")
  26.             rednet.close("right")
  27.             return
  28.           end
  29.           sleep(1)
  30.         end
  31.       end
  32.     end
  33.   end
  34.   print("Success!")
  35.   rednet.send(rec,"Success!")
  36. end
  37.  
  38. local count = 0
  39. repeat
  40.   status = turtle.up()
  41. --  status = true
  42.   count = count + 1
  43.   if count % dif == 0 then
  44.     rednet.send(rec,"Progress: "..count.." blocks!")
  45.   end
  46.   if not status then
  47.     if count % dif == 0 then
  48.       rednet.send(rec,"Failed!")
  49.       print("Failed!")
  50.       down()
  51.       rednet.close("right")
  52.       return
  53.     end
  54.   end
  55. until turtle.detectUp()
  56.  
  57. print("Success!")
  58. rednet.send(rec,"Success!")
  59. rednet.send(rec,"Sucking items...")
  60. write("Sucking items... ")
  61.  
  62. for i = 1, 16 do
  63.   if not turtle.suckUp() then
  64.     if i == 1 then
  65.       print("Failed!")
  66.       rednet.send(rec,"Failed!")
  67.       break
  68.     end
  69.     print("Success!")
  70.     rednet.send(rec,"Sucess!")
  71.     break
  72.   end
  73. end
  74. down()
  75. rednet.close("right")
Advertisement
Add Comment
Please, Sign In to add comment