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

How to detect a tree? / logs of any type?

Started by dextermb, 07 September 2012 - 12:18 PM
dextermb #1
Posted 07 September 2012 - 02:18 PM
I want to make a turtle where it will go round cutting down all of the trees in an area, and was wondering if there way a 'detect log' bit of code, where it will scan an area for some logs, then goes upto the logs and breaks them.

After getting a full inventory it will then come back to a chest at X Y Z and place the stuff back in the chest.

Is this possible?
PROdotes #2
Posted 07 September 2012 - 02:43 PM
I don't think there is.
That's why, when mining, i put smooth stone, dirt and gravel into slots 16,15 and 14 and tell it "don't mine this"…
you could tell it to not mine grass and sand (depending on the biome) and then let it loose on the trees in the area…
I made a turtle that can cut down 1 tree fast (logs, no leaves) by telling it "mine the block in front of you, then mine every block that's the same like that one…
that works on 1 normal tree… or a redpower rubber tree… doesn't work on a forest or thaumcraft trees…
minecraft has 4 types of trees… so you could put them into slots 1-4 and tell it to go cut everything that's in slots 1-4 and when it goes to empty it's inventory, clean everything but leave 1 itemcount into slots 1-4…
KaoS #3
Posted 07 September 2012 - 03:16 PM
yeah. and you would have to build a basic pathfinder program to navigate around, comparing blocks to the slots you want… pathfinding programs are a nightmare
dextermb #4
Posted 08 September 2012 - 12:40 PM
I don't think there is.
That's why, when mining, i put smooth stone, dirt and gravel into slots 16,15 and 14 and tell it "don't mine this"…
you could tell it to not mine grass and sand (depending on the biome) and then let it loose on the trees in the area…
I made a turtle that can cut down 1 tree fast (logs, no leaves) by telling it "mine the block in front of you, then mine every block that's the same like that one…
that works on 1 normal tree… or a redpower rubber tree… doesn't work on a forest or thaumcraft trees…
minecraft has 4 types of trees… so you could put them into slots 1-4 and tell it to go cut everything that's in slots 1-4 and when it goes to empty it's inventory, clean everything but leave 1 itemcount into slots 1-4…
yeah. and you would have to build a basic pathfinder program to navigate around, comparing blocks to the slots you want… pathfinding programs are a nightmare


Lol, ok so i won't attempt this xD
D3matt #5
Posted 08 September 2012 - 05:14 PM
yeah. and you would have to build a basic pathfinder program to navigate around, comparing blocks to the slots you want… pathfinding programs are a nightmare
If your tree farm is in a consistent pattern it shouldn't be difficult.Just move up and down the rows comparing the blocks on either side.
Lettuce #6
Posted 08 September 2012 - 05:19 PM
If you are using 1.4 you can use turtle.compareTo(slot) to find out what kind of tree it is.

Pathfinding is only as complicated as you make it. One of my programs just goes in a straight line to deposit items, then returns. Depends on its complexity.
GopherAtl #7
Posted 08 September 2012 - 05:31 PM
it's a bit involved for most situations, but if you absolutely, positively, must know if something is wood without player assistance or reference samples, a crafty turtle can check. Get nothing but the thing to be tested in inventory, and try crafting; if you get 4 new things, it is probably wood. Then do a vertical pair of those (ex, put some in slot 1 and some in slot 5, right below slot 1) and try crafting THAT. If you get 4 new items again, you definitely started with wood. I dunno of anything introduced in any major mod pack that can be crafted this same way.

As I said, probably more trouble than it's worth 99% of the time, but just thought I'd point it out :D/>/>