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

Correctly matching redwood blocks in turtle inventory with redwood blocks in world

Started by MLeeBrown, 04 June 2013 - 04:09 PM
MLeeBrown #1
Posted 04 June 2013 - 06:09 PM
Hey y'all,

I'm working on a hive of turtles that will move through a forest and cut down everything they can with minimal input from me. One of the things they need to be able to do is identify when they are in front of a tree. I haven't had any problems getting them to identify vanilla trees by using turtle.compare() to match the block in front of them with a wood block in their inventory, but I haven't been able to get the same results when comparing a block with a redwood block in the turtle's inventory. Is this bugged? Is there a type of redwood block I need to be using in order to make a proper comparison? The one I'm using is hacked off a 2x2 redwood in the "wild" and put in the turtle's inventory.

Any thoughts?

Thank you!
Lyqyd #2
Posted 04 June 2013 - 07:43 PM
Split into new topic.

The redwood log blocks most likely use metadata for their rotation, which means that the comparison will only work on one corner at maximum. Try a different corner.
valithor #3
Posted 05 June 2013 - 02:18 AM
Each of the redwood corner blocks have a different item number so to effectively get the entire tree you would need 4 blocks of redwood 1 of each corner
zazarath #4
Posted 05 June 2013 - 03:59 AM
might be an idea for your turtle to pick it up and use the refuel(0) comand on the block if it returns true you have wood if it returns false replace it and move on a lot of code to do that but saves problems with having to have 4 blocks of redwood, ps will also work with all types of wood, only thing i can see that might go wrong is if you get exposed coal in a mountion or something but then again you get coal so also not a bad thing
Lyqyd #5
Posted 05 June 2013 - 10:25 AM
Saplings are also usable as fuel, so you'd end up with a tree farm that does nothing but inefficiently fuel a turtle.
theoriginalbit #6
Posted 05 June 2013 - 10:28 AM
might be an idea for your turtle to pick it up and use the refuel(0) comand on the block if it returns true you have wood if it returns false replace it and move on a lot of code to do that but saves problems with having to have 4 blocks of redwood, ps will also work with all types of wood, only thing i can see that might go wrong is if you get exposed coal in a mountion or something but then again you get coal so also not a bad thing
Better method would be to try to place above the turtle, a sapling cannot be placed on a turtle, wood can be.
zazarath #7
Posted 05 June 2013 - 10:45 AM
Better method would be to try to place above the turtle, a sapling cannot be placed on a turtle, wood can be.

or use a mix of both so if refuel(0) and turtle.placeUp() = true then you have wood, just to make sure you haved picked up dirt or coble by accident. but then again you also need to make sure you have nothign ontop of your tutle before the place up so watch out for that. this will also stop you from picking up coal too. =)


and yer i didnt thign about saplins =p good point but yer the mix of the 2 check would work.