31 posts
Location
Brazil
Posted 20 May 2014 - 04:26 AM
Is there a way that I can make my turtle count how much itens are in a chest?
1281 posts
Posted 20 May 2014 - 08:53 AM
Unless you have openP installed, no.
1140 posts
Location
Kaunas, Lithuania
Posted 20 May 2014 - 09:27 AM
Actually, you can, but it would take a little time to count it.
What I would do is suck all items from the chest, while counting how many I sucked, and put them into another chest. Then put them back from one chest to another if necessary.
7508 posts
Location
Australia
Posted 20 May 2014 - 09:34 AM
definitely possible using the technique MKlegoman357 suggested. assuming you have something like an iron chests mod installed you could easily have the Turtle count the items in any chest in a few lines of code. If you want to use his method you'll need to take a look into the
Turtle API.
31 posts
Location
Brazil
Posted 20 May 2014 - 04:29 PM
How can I do using openP cuz I have it!
7508 posts
Location
Australia
Posted 21 May 2014 - 02:11 AM
you need to
wrap the chest as a peripheral. And make use of the
getAllStacks method; this will give you a table of tables representing all the items in the chest, you then loop through the, and get the quantity of from each table, the quantity is stored under the
qty key. All in all, its about 5 lines of code.