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

[Question?] Strange issue with saplings and turtle.compare

Started by nO_OnE, 13 December 2012 - 03:35 AM
nO_OnE #1
Posted 13 December 2012 - 04:35 AM
Hello,

I recently scripted some (meanwhile quite complicated) tree farmer and saw some strange behaviour of the turtle when it's comparing every sapling with the sapling item in its slot. It is programmed to destroy any no sapling block which is where a sapling should be and (re-)place a sapling there. When I tested this function it destroyed about a third of the saplings and replaced them…

My Code: http://pastebin.com/4aZfqGMN (change saplingMethod to "compare" to see what I'm talking about) (see the note at the very end of the script, there I put this issue too)

Maybe you have some ideas why the turtle behaves like that ;)/>
huettner94 #2
Posted 13 December 2012 - 08:25 AM
It's a known Bug (http://www.computercraft.info/forums2/index.php?/topic/6776-turtlecompare/page__hl__turtle.compare__fromsearch__1)
The turtle compares the Metadata as well, which increases on a sapling on each world tick.
The only workaround I could think of would be to check if there is a wood block and then replace it with a sapling.
nO_OnE #3
Posted 13 December 2012 - 08:36 AM
Ohh, thanks so much! It seemed so random to me that I just could make any sense…
To your workaround, I think you missunderstood my Script, the question is not 'is there wood or a sapling', the question is 'is there a sapling' to plant the saplings on the first run for example.

Edit: If the Metadata of the sapling changes every world tick, why does the turtle destroy only about a third of the saplings and not all of them? The saplings were plant about 15 seconds before being checked.
Edited on 13 December 2012 - 07:40 AM