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

Turtle.Compare()

Started by Noodle, 02 September 2012 - 05:21 PM
Noodle #1
Posted 02 September 2012 - 07:21 PM
Add turtle.compare() to chests to see whats inside?
slot = turtle.compare() -- slot in chest
turtle.suck(slot)
dan200 #2
Posted 02 September 2012 - 08:31 PM
turtle.compare() already exists :s
matejdro #3
Posted 02 September 2012 - 08:56 PM
Yeah, turtle.compare() is already occupied (in your situation for example, it could be used to figure out if chest is really in front of you).

Also, I cannot see what would your command be useful for, except for maybe if your turtle is completely full. You can already just pull item out, compare it inside turtle and then put it back in.

But yeah, ability to compare with anything else than just first item in the chest would be really useful.

EDIT: wait, I have read your post again and I don't really get it. When you execute compare function, you would get a slot number. Which number would be that? First full slot in the chest or something?
Noodle #4
Posted 02 September 2012 - 09:23 PM
My suggestion was to check inside chests not for the chests..
Like turtle.compareInside() or something.
It would scan for the item inside the chest and return the slot number.
Example:
Turtle Slot1 = Slimeball – Selected slot
Chest Slot23 = Slimeball
-
print(turtle.compareInside())
Would print 23.

EDIT: Its more for a sorting system, turtle comes up to excavate then another turtles takes the supplies like cobble, and puts them in a designated chest.
matejdro #5
Posted 02 September 2012 - 09:25 PM
Ah, I get it now. Sounds OK.
FuzzyPurp #6
Posted 02 September 2012 - 09:26 PM
Topic moved. Please refer to the Turtle API on the wiki for usage.
matejdro #7
Posted 02 September 2012 - 09:27 PM
Um, he was suggesting new use for compare() function, not asking how to use it.
Noodle #8
Posted 02 September 2012 - 09:32 PM
Why was this moved to Ask a Pro.
I can read the API's on the wiki
I was suggesting a new use for turtle.compare()

Another thing, since compareTo([slot]) exists then
turtle.compareInsideTo(2) – Compares turtle slot 2 to the items in the chest.