Sayomie550

Untitled

Jan 10th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. --[[
  2. Stab Bot 9000 V:1.0.0
  3. Slot 1 = unwanted item
  4. --]]
  5. local stabbed = 0
  6. local slot = 0
  7. local direction = 0
  8.  
  9. while true do
  10.  
  11.     function display()
  12.         term.clear()
  13.         term.setCursorPos(1,1)
  14.         print("Stab Bot 9000 V1.0.0")
  15.         print("------------------------------------")
  16.         print("Number of mobs stabbed: " ..stabbed)
  17.         print("------------------------------------")
  18.     end
  19.    
  20.     function attack()
  21.         if turtle.attack() then
  22.             stabbed = stabbed + 1
  23.         end
  24.     end
  25.    
  26.     function gather()
  27.         turtle.suck()
  28.         sleep(.1)
  29.     end
  30.    
  31.     function chest()
  32.         if turtle.dropUp() then
  33.         else
  34.             if direction = 0 then
  35.                 turtle.turnRight()
  36.                 direction = direction + 1
  37.                 turtle.dropRight()
  38.             else
  39.                 turtle.dropRight
  40.             end
  41.         end
  42.     end
  43.    
  44.     function deposit()
  45.                 if turtle.getItemSpace(16) < 64 then
  46.                         slot = 2
  47.                         while slot < 17 do
  48.                             turtle.select(slot)
  49.                             if turtle.compareTo(1) then
  50.                                 turtle.dropDown()
  51.                             else
  52.                                 chest()
  53.                             end
  54.                             slot = slot + 1
  55.                             sleep(.1)
  56.                         end
  57.                        
  58.                         if direction = 1 then
  59.                             turtle.turnLeft()
  60.                         elseif direction = 2 then
  61.                             turtle.turnLeft
  62.                         end
  63.                         turtle.select(2)
  64.                 end
  65.         end
  66.    
  67.     sleep(.1)
  68.     display()
  69.     attack()
  70.     gather()
  71.     deposit()
  72. end
Advertisement
Add Comment
Please, Sign In to add comment