Guest User

disposal

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