ShivaFang

Turtle Sword Test

Sep 8th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. function getBlock()
  2.   turtle.turnRight()
  3.   turtle.suck()
  4.   turtle.turnLeft()  
  5. end
  6.  
  7. function placeDig()
  8.   turtle.place()
  9.   turtle.dig()
  10. end
  11.  
  12. function dumpSword()
  13.   turtle.turnLeft()
  14.   turtle.turnLeft()
  15.   while not turtle.drop() do
  16.     print("Inventory is full....")
  17.     sleep(10)
  18.   end
  19.   turtle.turnRight()
  20.   turtle.turnRight()
  21.   getBlock()
  22. end
  23.  
  24. function checkSlot()
  25.   if (turtle.getItemCount(1)) == 0 then
  26.     getBlock()
  27.   else
  28.     if (turtle.compareTo(16)) then
  29.       dumpSword()
  30.     end
  31.   end
  32. end
  33.  
  34. function run()
  35.   turtle.select(1)
  36.   while true do  
  37.     checkSlot()
  38.     placeDig()
  39.   end
  40. end
  41.  
  42. run()
Advertisement
Add Comment
Please, Sign In to add comment