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

Compare Script for Turtle to Compare to items in a chest

Started by rwilkin, 30 April 2014 - 07:33 AM
rwilkin #1
Posted 30 April 2014 - 09:33 AM
Hi, I'm very new to programming lua and computercraft in general.

I have items floating around in water and would like to use a turtle to look at the items as they go past and pick them up if they are in a specific chest of items.

So if I have a chest full of dusts, the turtle will pick up all of the dust items as they go past.

I had a look at the turtle.detect and turtle.compare methods but they seem to detect the block type in front (which will always be water) and compare to the selected internal inventory slot.

Can anyone point me in the right direction to be able to do this?
I am thinking maybe have a computer next to the chest or maybe another turtle and using rednet to do the comparisons but I'm not even sure that's possible.

Thank you in advance for any help.
Lyqyd #2
Posted 30 April 2014 - 03:24 PM
You'd have to suck the items out of the water and examine them, then spit out any items you didn't want.
rwilkin #3
Posted 01 May 2014 - 06:00 AM
Awesome I'll try that today. Is there a way to compare the items via rednet?
Lyqyd #4
Posted 01 May 2014 - 06:02 AM
I'm not sure what that would even entail. A turtle can only compare two things in its inventory, or a thing in its inventory and block in the world above, in front of or below it together, so the only way rednet could get involved would be the turtle telling something else what the results of a comparison it had performed locally were. If you're asking what I think you're asking, the answer is no, that's not possible.
Bomb Bloke #5
Posted 01 May 2014 - 08:09 AM
OpenPeripheral can expand these abilities somewhat - it grants the option of out-right identifying items.

Generally those items need to be stored in a container of some sort (eg a vanilla chest), which you then wrap as a peripheral, and can then start probing.
rwilkin #6
Posted 01 May 2014 - 11:18 AM
Thank you both, I will have a look at OpenPeripheral and see what I can come up with.