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

very slight but useful change to turtle.compare()

Started by etopsirhc, 27 December 2012 - 07:02 PM
etopsirhc #1
Posted 27 December 2012 - 08:02 PM
as is compare and compareTo checks if both the ID and meta data is the same as the item its holding, but it cant detect if its the same type of block but just slightly different.

so i propose a change to the command to include a optional boolean value that is normally set to true , but if the user wants they can set it to false making it compare only the id and not the meta data. this way items like wool , logs , saplings , and dyes will be detected as the same item type even if one is blue and the other is red.

this shouldn't be over powered but would be a rather nice and fairly simple change. but just to be clear i am NOT asking for the over used "gimme the items id" :P/>
ChunLing #2
Posted 27 December 2012 - 10:04 PM
I believe that they were working on altering compare to use the "pick block" value, so that it wouldn't be as badly affected by metadata and such (it would also be highly valuable in that it should allow comparison of ores to their resource drops). I'm not sure how much progress they've made on that.
Cloudy #3
Posted 27 December 2012 - 11:22 PM
I don't like the idea of just comparing against ID. Once we improve compare most issues should go away.
immibis #4
Posted 28 December 2012 - 12:21 PM
How does compare handle damage bars? (currently or after the planned changes)
Cloudy #5
Posted 28 December 2012 - 01:58 PM
How does compare handle damage bars? (currently or after the planned changes)

Why would compare care about damage bars? These are blocks in the world
Lyqyd #6
Posted 28 December 2012 - 02:12 PM
compareTo() isn't blocks in the world, necessarily. ;)/>

Edit: Though, you are absolutely right, in that compare() is just blocks in the world.
etopsirhc #7
Posted 28 December 2012 - 08:50 PM
some blocks in the world have damage bars ( kinda ) look at factorization and its batteries
immibis #8
Posted 28 December 2012 - 11:44 PM
How does compare handle damage bars? (currently or after the planned changes)

Why would compare care about damage bars? These are blocks in the world
Yep, dumb question. I did mean compare btw, not compareTo.