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

Turtle.compare improvement

Started by BrolofTheViking, 09 October 2012 - 07:10 PM
BrolofTheViking #1
Posted 09 October 2012 - 09:10 PM
Before anybody gets mad at this, I'm not asking for getting item IDs, or being able to remember an item for future comparing.

While I was making a turtle-run tree farm, a small error in my coding caused a turtle to place a log instead of a sapling. What ended up happening was that, because this is minecraft 1.3.2, the log was placed sideways. The program had been running for quite some time with logs in the slot of saplings, but I noticed that every time it reached a log it had placed, it thought the log was the base of a tree, which shouldn't have happened. The turtle should have compared that placed log, which it thought was a sapling, to the logs in its inventory, which it also thinks are saplings, found them to be the same, and continued going.

It appears that the turtle also compares damage values, which in most cases would be a beneficial feature, except in the case of logs. Because sideways logs have a different damage value, turtle.compare() returns sideways logs as being a different item than logs in an inventory.

Since it is impossible to get sideways logs as an item, in situations where a turtle is roaming while looking for wood (such as in this http://www.computerc...62-competition/ ) and comes across a large oak tree, it wouldn't be able to identify the branches as being logs.

I propose that the turtle.compare() function should be changed so that logs of the same type (birch, spruce, oak) return as the same item, ignoring the damage value denoting them as being sideways logs.

EDIT: I am using computercraft 1.42, so if this has been changed in 1.43, somebody please tell me.
OmegaVest #2
Posted 09 October 2012 - 09:36 PM
I think the problem here would be that every single damage value set that had no real difference between them would have to be manually coded. And if you had any other mods that used the same mechanic, they would not be recognized by ComputerCraft. Now, obviously you could have the config have a small space for "ignore damage values here", but in places like Forestry and Extra BiomesXL, where the damage values are often split between rotated blocks and entirely different ones, it wouldn't be able to tell the difference.

So, yes I can understand needing it for a tree farm, but adding this rather encompassing function for one use is. . . unnecessary to the point of being counterproductive. It would be infinitely more productive to attempt to convince Mojang to change to Forge and use Metadata better.
BrolofTheViking #3
Posted 09 October 2012 - 09:44 PM
Well yes, it would have to be manually coded in the instance of trees. I wasn't considering it for other mods and the like, I simply meant in the instance of trees. I do not think it would have to be such an extensive system, but since trees are a relatively common vanilla block, I think it is still something that could be applicable frequently enough that it would merit what I think, although I may be incorrect, would be a rather simple change.
Cloudy #4
Posted 09 October 2012 - 10:18 PM
We now use the pick block logic to decide what the block we are comparing as should be an item. This will mean that redstone wires, mod blocks (if the mod author adds support), etc, should now be compared correctly, if the item can be used to place the block :P/>/>

Coming Soon™ to a CC release near you!
BrolofTheViking #5
Posted 10 October 2012 - 11:40 AM
awesome
Starwaster #6
Posted 29 November 2012 - 04:29 AM
We now use the pick block logic to decide what the block we are comparing as should be an item. This will mean that redstone wires, mod blocks (if the mod author adds support), etc, should now be compared correctly, if the item can be used to place the block :)/>/>

Coming Soon™ to a CC release near you!

So what's the ETA on this change? Seems like turtles still have the same compare() behavior as before.
Cloudy #7
Posted 29 November 2012 - 04:29 AM
When I can get the forge hook in.
Cranium #8
Posted 29 November 2012 - 05:34 AM
When I can get the forge hook in.
Just ram it in there. ME WANT NEW RELEASE ;)/>
Tiin57 #9
Posted 29 November 2012 - 10:37 AM
When I can get the forge hook in.
Just ram it in there. ME WANT NEW RELEASE ;)/>
You try ramming anything into Forge. :P/>
It ain't easy.
Starwaster #10
Posted 29 November 2012 - 06:05 PM
When I can get the forge hook in.
Just ram it in there. ME WANT NEW RELEASE ;)/>
You try ramming anything into Forge. :P/>
It ain't easy.

Well why not just…. FORGE on ahead!

(/me ducks)
Tiin57 #11
Posted 30 November 2012 - 12:41 AM
-snip-
Well why not just…. FORGE on ahead!

(/me ducks)
Ducking would be a good idea.
That was a corny, obvious joke.
I like it. :P/>