SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | - | local rec = 31 |
| 2 | + | This script is used at the server |
| 3 | Geevancraft 2. | |
| 4 | It is a secret way of storing | |
| 5 | my valuables. | |
| 6 | ]]-- | |
| 7 | ||
| 8 | local dif = 25 | |
| 9 | local rec = 0 -- rednet receiver id | |
| 10 | ||
| 11 | for i = 1, 16 do | |
| 12 | if turtle.getItemCount(i)>0 then | |
| 13 | break | |
| 14 | end | |
| 15 | if i == 16 then | |
| 16 | print("You need at least 1 item to preform this program!")
| |
| 17 | return | |
| 18 | end | |
| 19 | end | |
| 20 | ||
| 21 | ||
| 22 | rednet.open("right")
| |
| 23 | rednet.send(rec,"Disposaling items!") | |
| 24 | rednet.send(rec,"Heading up... ") | |
| 25 | write("Heading up... ")
| |
| 26 | ||
| 27 | function down() | |
| 28 | write("Heading down... ")
| |
| 29 | rednet.send(rec, "Heading down...") | |
| 30 | local count = 0 | |
| 31 | while not turtle.detectDown() do | |
| 32 | count = count + 1 | |
| 33 | if count % dif == 0 then | |
| 34 | rednet.send(rec,"Progress: "..count.." blocks!") | |
| 35 | end | |
| 36 | count2 = 0 | |
| 37 | while not turtle.down() do | |
| 38 | if not turtle.digDown() then | |
| 39 | if not turtle.attackDown() then | |
| 40 | count2 = count2 + 1 | |
| 41 | if count2 % dif == 0 then | |
| 42 | print("Failed!")
| |
| 43 | rednet.send(rec,"Failed!") | |
| 44 | return | |
| 45 | end | |
| 46 | sleep(1) | |
| 47 | end | |
| 48 | end | |
| 49 | end | |
| 50 | end | |
| 51 | print("Success!")
| |
| 52 | rednet.send(rec,"Success!") | |
| 53 | end | |
| 54 | ||
| 55 | local count = 0 | |
| 56 | repeat | |
| 57 | status = turtle.up() | |
| 58 | count = count + 1 | |
| 59 | if count % dif == 0 then | |
| 60 | rednet.send(rec,"Progress: "..count.." blocks!") | |
| 61 | end | |
| 62 | if not status then | |
| 63 | if count % dif == 0 then | |
| 64 | rednet.send(rec,"Failed!") | |
| 65 | print("Failed!")
| |
| 66 | down() | |
| 67 | rednet.close("right")
| |
| 68 | return | |
| 69 | end | |
| 70 | end | |
| 71 | until turtle.detectUp() | |
| 72 | ||
| 73 | print("Success!")
| |
| 74 | rednet.send(rec,"Success!") | |
| 75 | rednet.send(rec,"Dropping off items...") | |
| 76 | write("Dropping off items... ")
| |
| 77 | ||
| 78 | for i = 1, 16 do | |
| 79 | if turtle.getItemCount(i) > 0 then | |
| 80 | turtle.select(i) | |
| 81 | if not turtle.dropUp() then | |
| 82 | rednet.send("Failed!")
| |
| 83 | print("Failed!")
| |
| 84 | break | |
| 85 | end | |
| 86 | end | |
| 87 | end | |
| 88 | rednet.send(rec,"Success!") | |
| 89 | print("Success!")
| |
| 90 | turtle.select(1) | |
| 91 | down() | |
| 92 | rednet.close("right") |