jille_Jr icon

CC: Gather

jille_Jr | PRO | 12/17/12 02:26:08 PM UTC | 0 ⭐ | 326 👁️ | Never ⏰ | []
Lua |

1.72 KB

|

None

|

0 👍

/

0 👎

--[[
    This script is used at the server
    Geevancraft 2.
    It is a secret way of storing
    my valuables.
]]--
 
local dif = 25
local rec = 0 -- rednet receiver id
 
rednet.open("right")
rednet.send(rec,"Gathering items!")
rednet.send(rec,"Heading up... ")
write("Heading up... ")
 
function down()
  write("Heading down... ")
  rednet.send(rec, "Heading down...")
  local count = 0
  while not turtle.detectDown() do
    count = count + 1
    if count % dif == 0 then
      rednet.send(rec,"Progress: "..count.." blocks!")
    end
    count2 = 0
    while not turtle.down() do
      if not turtle.digDown() then
        if not turtle.attackDown() then
          count2 = count2 + 1
          if count2 % dif == 0 then
            print("Failed!")
            rednet.send(rec,"Failed!")
            rednet.close("right")
            return
          end
          sleep(1)
        end
      end
    end
  end
  print("Success!")
  rednet.send(rec,"Success!")
end
 
local count = 0
repeat
  status = turtle.up()
--  status = true
  count = count + 1
  if count % dif == 0 then
    rednet.send(rec,"Progress: "..count.." blocks!")
  end
  if not status then
    if count % dif == 0 then
      rednet.send(rec,"Failed!")
      print("Failed!")
      down()
      rednet.close("right")
      return
    end
  end
until turtle.detectUp()
 
print("Success!")
rednet.send(rec,"Success!")
rednet.send(rec,"Sucking items...")
write("Sucking items... ")
 
for i = 1, 16 do
  if not turtle.suckUp() then
    if i == 1 then
      print("Failed!")
      rednet.send(rec,"Failed!")
      break
    end
    print("Success!")
    rednet.send(rec,"Sucess!")
    break
  end
end
down()
rednet.close("right")

Comments