This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
JFMillerUSA's profile picture

spinning melee turtle help

Started by JFMillerUSA, 10 September 2015 - 03:08 PM
JFMillerUSA #1
Posted 10 September 2015 - 05:08 PM
newby here, this is my code not sure whats wrong

while turtle.detect() do
turtle.attack()
turtle.suck()
repeat
turtle.turnLeft()
until turtle.detect()
end
Lyqyd #2
Posted 10 September 2015 - 05:36 PM
The turtle.detect function only detects blocks. There is no built-in function to detect the presence of an entity.
Bomb Bloke #3
Posted 11 September 2015 - 01:29 AM
… other than turtle.attack(), that is - even if that's not its primary purpose. It can only "detect" that which it can attack, but that happens to fit your needs anyway:

while true do
  if turtle.attack() then
    turtle.suck()
  else
    turtle.turnLeft()
  end
end
Edited on 10 September 2015 - 11:35 PM