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

basic turtle function not working as i intended, help!

Started by Cenarius, 05 January 2014 - 12:24 AM
Cenarius #1
Posted 05 January 2014 - 01:24 AM
Hello guys!
so i was messing around with turtles, i wrote a simple test :


function MoveOn()
turtle.forward()
  if turtle.detect() then
   turtle.turnLeft()
  end
end
function Farm()
MoveOn()
  if turtle.compareDown() then
   turtle.digDown()
  end
end

turtle.select(16)

while true do
Farm()
end

now i put a wheat in slot 16, but it is not farming it :/

i was trying to find out what's wrong so i tried the same with a digging turtle, and i put dirt in slot 16 and some on the turtle's way, it worked, so i'm confused..
help me out please, what am i doing wrong?
Lyqyd #2
Posted 05 January 2014 - 02:40 PM
Wheat items are not the same as wheat blocks, so compare will return false.
Cenarius #3
Posted 05 January 2014 - 04:20 PM
Wheat items are not the same as wheat blocks, so compare will return false.

oh, i see, so how can the turtle to detect blocks that i can't get?
i looked up the wiki and i can't find any other functions to do this :/
are there any mods or ways around this?
Bomb Bloke #4
Posted 05 January 2014 - 06:44 PM
A regular ComputerCraft turtle cannot determine whether wheat has grown. I gather Aperture Science turtles can.

I made a 16x16 space and had my turtle harvest it once an hour. Probably 95% of the wheat has grown by the time it performs each sweep. Given that you can usually expect it to take at least half an hour for wheat to grow, having the turtle constantly roam the plot looking for grown plants would seemingly wind up achieving only a slight increase in production in exchange for a massive wastage of fuel.
Cenarius #5
Posted 05 January 2014 - 07:53 PM
A regular ComputerCraft turtle cannot determine whether wheat has grown. I gather Aperture Science turtles can.

I made a 16x16 space and had my turtle harvest it once an hour. Probably 95% of the wheat has grown by the time it performs each sweep. Given that you can usually expect it to take at least half an hour for wheat to grow, having the turtle constantly roam the plot looking for grown plants would seemingly wind up achieving only a slight increase in production in exchange for a massive wastage of fuel.

interesting, i hear aperture science is too op, dun want that coz it's kinda pointless if there is no challenge xD
Thanks for the tip though

i don't really care about making a farm i was just messing around with the functionality and got confused..

Thanks again guys
subzero22 #6
Posted 06 January 2014 - 10:49 AM
you might want to test it on reeds then as I got a turtle that will start farming reeds when the reed it detects is fully grown.