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

Get Inventory of an ME System [AE2]

Started by CAndeMan, 04 April 2015 - 09:52 AM
CAndeMan #1
Posted 04 April 2015 - 11:52 AM
I've googled high and low for this answer but I can't find the straight solution. I am using the FTB Infinity mod.

I would like to use a computer to query an ME System's inventory to see how much of any item I have in there. I don't know what peripheral setup or API I need to use to get this done though. When I have a computer next to a ME Controller I don't get any methods that where described in this thread [link] and that was my only lead… So I really don't know what else to do.

Any help is appreciated.
SquidDev #2
Posted 04 April 2015 - 07:15 PM
I've not used OpenP that much but some of the documentation is in game. If you plonk any part of an AE network (Interface, drive, etc…) next to a computer a folder called openp should be created. In there is a file called docs running that should give you some information on the attached peripheral - in this case an interface or whatever.

The main source for OpenP's AE code is here. Anything marked @ScriptCallable is a peripheral function its a rather hard to read but should give you a bit of a guideline.
Edited on 04 April 2015 - 05:15 PM
CAndeMan #3
Posted 04 April 2015 - 10:33 PM
I understand the code you linked, but I don't get any of those when I run the docs command myself. And every method it does give me essentially returns nil (like getAllStacks()) so I don't know, I've tried it next to an Interface and a Controller and I get all the same. I don't know what else to do.
bryanschmidty #4
Posted 28 November 2015 - 12:38 AM
This reply is late, but I hope it helps someone.

First, you'll want to wrap your ME Access Terminal or Crafting Terminal. For the example below, I'm using the Access Terminal, but the methods will be the same for either.
Then, you'll use the getAvailableItems() method to get a table of all the items. This will give you names, quantities and more for everything you have.

local me = peripheral.wrap("appeng_me_tileterminal_0")
local available = me.getAvailableItems()
for i=1,#available do
	print(available[i]["name"] .. " = " .. available[i]["qty"])
end

Happy ComputerCrafting!
DatMonkeyDew #5
Posted 17 May 2016 - 12:47 PM
I have attempted to replicate this however I am probably using a different version since I am running FTB Infinity Evolved and it does not seem compatible:

local me = peripheral.wrap("appeng_me_tileterminal_0")
local available = me.getAvailableItems()
for i=1,#available do
print(available[i]["name"] .. " = " .. available[i]["qty"])
end

I have tried altering it:


local me = peripheral.wrap("back")
local available = me.getAvailableItems()
for i=1,#available do
		print(available[i]["name"] .. " " .. available[i]["qty"])

end

Now, the list does exist but I have a feel that the '["name"]' is null as it can not concatenate to a string.

I aim to achieve the same outcome as the previous post only with the version in FTB Infinity Evolved.
Edited on 17 May 2016 - 03:01 PM