Advertisement
QQII

Attack Turtle V0.1

Mar 28th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. --Attack Turtle V0.1 by QQII
  2. --Functions
  3. local function clearSlot(slotNumber)    --Attemps to clear the slot slotNumber
  4.     turtle.select(slotNumber)
  5.     if turtle.getItemCount(slotNumber) ~= 0 then
  6.         if not turtle.dropDown() then
  7.             print("ERROR: failure to clear slot number " .. slotNumber)
  8.         end
  9.     end
  10. end
  11.  
  12. local function clearSlots()     --Places all the items into the chest under the turtle
  13.     for i = 1,16 do
  14.         if turtle.getItemCount(i) ~= 0 then
  15.             clearSlot(i)
  16.         end
  17.     end
  18. end
  19.  
  20. --User Inputs
  21. print("The turtle will attack mobs above it.")
  22. print("It will place items in an inventory below it.")
  23.  
  24. --Main Script
  25. while true do
  26.     while not turtle.attackUp() do
  27.         clearSlots()
  28.     end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement