Advertisement
Aixler

Attack

Feb 15th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. -- wait till redstone... and then cool down 3000 hits
  2. function detect()
  3.     while not redstone.getInput(side) do
  4.         os.sleep(30)
  5.     end
  6.    
  7.     while redstone.getInput(side) do
  8.         attack()
  9.     end
  10.    
  11.     counter = 60
  12.    
  13.     while counter > 0 do
  14.         attack()
  15.         counter = counter - 1
  16.     end
  17. end
  18.    
  19. -- kill whatever is in front
  20. function attack()
  21.         turtle.attack()
  22.         if turtle.getItemCount(4) > 0 then
  23.                 for x=1, 16 do
  24.                         turtle.select(x)
  25.                         turtle.dropDown()
  26.                 end
  27.                 turtle.select(1)
  28.         end
  29.     sleep(0.5)
  30. end
  31.  
  32.  
  33. -- ---------- Running programm ----------
  34. -- Set params
  35. side = "back"
  36.  
  37. -- repeat loop and never stop
  38. repeat
  39.     result, err = pcall(detect)
  40.     if not result then
  41.         print("Horrible nasty stuff happened...")
  42.         print(err)
  43.         print("Whatever happend... The killing needs to resume!")
  44.     end
  45.    
  46.     os.sleep(60)
  47. until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement