2 posts
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
8543 posts
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.
7083 posts
Location
Tasmania (AU)
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