Advertisement
Aixler

attack16

Oct 16th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. -- wait till redstone event, then attack
  2.  
  3. function detect()
  4.     os.pullEvent("redstone")   
  5.     while redstone.getInput(side) do
  6.         turtle.attack()
  7.         sleep(0.5)
  8.     end
  9. end
  10.    
  11. -- ---------- Running programm ----------
  12. -- Set params
  13. side = "back"
  14.  
  15. -- repeat loop and never stop
  16. repeat
  17.     result, err = pcall(detect)
  18.     if not result then
  19.         print("Horrible nasty stuff happened...")
  20.         print(err)
  21.         print("Whatever happened... The killing needs to resume!")
  22.     end
  23. until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement