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

Item Sorting

Started by Hurr1caneAlpha, 05 April 2015 - 01:37 PM
Hurr1caneAlpha #1
Posted 05 April 2015 - 03:37 PM
I've been trying to get a program for this to work for a while, but I simply can't get it working.

Basically, I am wanting to have a Turtle sorting system, where the turtle can pull items for 1 inventory, into other inventories. So, for example, I want the Turtle to pull items out of Chest A. In Chest A, there are 5 Cobblestone. I want to the turtle to pull 3 items out of Chest A, and put them into Chest B. Then, I want the remaining 2 Items in Chest A to be placed in Chest C.

It would be absolutely amazing if I could get a hand with this, because I am absolutely clueless about it, and severly struggle when it comes to coding.
Lupus590 #2
Posted 05 April 2015 - 06:53 PM
Do you have any code at the moment?

You will want to use a lot of turtle.compareTo or turtle.getItemDetail
Edited on 05 April 2015 - 04:54 PM
Hurr1caneAlpha #3
Posted 06 April 2015 - 05:26 PM
I have absolutely none, because I've tried to do it several times with different methods, none of which worked.
Lupus590 #4
Posted 06 April 2015 - 06:32 PM
what you want to do is pull an item out of the chest, identify the item and put it into another chest all this uses the turtle API
Hurr1caneAlpha #5
Posted 09 April 2015 - 05:02 PM
Right, I have got absolutely no idea what I'm doing here… I'm sorry, but can you write the program for me, and try and explain it using comments? I really don't know what I'm doing :/
Akitake #6
Posted 09 April 2015 - 06:14 PM
We're not really supposed to be making programs for you, but helping you get there.
I have a sorting system myself using turtles, and a server whitelist with a file for each chest (1,2,3, etc..) in which I put the item name I want to sort, one by line ("minecraft:torch" for example).
I'm using a third party addon called quadracopters for this though, because turtles move slow. I simply use the turtle to pull out the item out of the input chest, then it sends the item name as a rednet message to the server, which then returns the chest number that this item should go into. And then I simply have a table with the path quadracopters have to follow, so if the server returns 1, then I simply do flyQuad(path[1]) and make it drop into the chest, and then do the path backwards, which is made easely with "return" in that third party mod

You could very easely use the same concept of a paths table for each chest using turtles, it would just be a lot slower.
I'm not giving you actual code here until you post yours, and then I could help you get there, but if you don't try yourself, then I'm sorry.