Advertisement
hevohevo

ComputerCraft Tutorial: auto_melee_trap0_1

Jan 31st, 2014
6,500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. -- #################################
  2. -- auto_melee_trap
  3. -- version 0.1a
  4. -- http://hevohevo.hatenablog.com/
  5. -- The turtle suspends the operation during the redstone ON.
  6.  
  7. -- #################################
  8.  
  9. Side = "back"
  10.  
  11. turtle.select(1)
  12.  
  13. while true do
  14.   if not rs.getInput(Side) then --redstone OFF
  15.     turtle.attack()
  16.     turtle.suck()
  17.     turtle.dropDown()
  18.   else -- redstone ON
  19.     -- wait for the inputted signal to change OFF
  20.     print("suspend")
  21.     os.pullEvent("redstone")
  22.     print("attack")
  23.   end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement