Ledger Nano X - The secure hardware wallet
SHARE
TWEET

turtle bucket filler

kssr3951 Jun 12th, 2014 245 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- turtle bucket filler
  2. -- slot1 : sample backet (oil, lava, etc)
  3. rs.setOutput("back", true);
  4. while true do
  5.   print("turtle bucket filler");
  6.   for i=2, 16 do
  7.     turtle.suck();
  8.   end
  9.   local foundIdx = -1;
  10.   for i=2, 16 do
  11.     turtle.select(i);
  12.     if -1 == foundIdx then
  13.       cnt = turtle.getItemCount(i);
  14.       if 0 < cnt then
  15.         if true == turtle.compareTo(1) then
  16.           turtle.drop();
  17.         else
  18.           foundIdx = i;
  19.           turtle.drop(cnt - 1);
  20.         end
  21.       end
  22.     else
  23.       turtle.drop();
  24.     end
  25.   end
  26.   if -1 ~= foundIdx then
  27.     rs.setOutput("back", false);
  28.     while true do
  29.       turtle.select(foundIdx);
  30.       turtle.placeDown();
  31.       if true == turtle.compareTo(1) then
  32.         rs.setOutput("back", true);
  33.         turtle.drop();
  34.         print("filled one bucket.");
  35.         break;
  36.       end
  37.       sleep(1);
  38.       print("no liquid. retry.");
  39.     end
  40.   else
  41.     print("no empty bucket.");
  42.   end
  43.   sleep(1);
  44. 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