Advertisement
Captn_Mal1972

patrol2

Feb 1st, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. --- Patrol In a straight line
  2.  
  3. local tArgs = { ... }
  4. if #tArgs ~= 1 then
  5. print( "Usage: patrol length" )
  6. return
  7. end
  8. local length = tonumber( tArgs[1] )
  9. local message = ""
  10. rednet.open ("right")
  11.  
  12.  
  13. while turtle.getFuelLevel()> 20 do
  14.  
  15. for i=1, length do
  16. rednet.receive(2)
  17. if message == "attack" then
  18. turtle.attack()
  19. end
  20. turtle.forward()
  21. rednet.receive(2)
  22. end
  23.  
  24. turtle.turnLeft()
  25. turtle.turnLeft()
  26.  
  27.  
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement