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

Question about ItemIDs

Started by psyestorm, 10 July 2013 - 08:50 AM
psyestorm #1
Posted 10 July 2013 - 10:50 AM
Hi All,

I'm working on an project with the MiscPeripherals ME Bridge and I'm having a bit of trouble understanding some concepts. I was hoping to get some help from the community.

The ME Bridge Peripheral lets you retrieve items from an ME network by using an items ID.

1. Is there anyway to tell an items name from its ID? Or Item IDs from names?
2. Do item IDs change between versions?
3. Whats an easy way to get IDs? For example. NEI Shows cactus green dye as 351:2, but the ItemID on the ME Bridge is 65887. Is there a way to convert between these?

Thanks in advance

-Psye
Bubba #2
Posted 10 July 2013 - 11:59 AM
You can use OpenPeripheral in conjuction with OpenCCSensors to get real item IDs/names. Although I've never tried, I imagine you would have to export items out of the network in order to get their name using OpenCCSensors. OpenPeripheral, however, can access the item IDs directly.

Take a look at the OpenPeripheral Help Page. It has info on the ME Chest (Not the ME Drive, but the ME Drive does not provide such functionality), which can be wrapped to get Item IDs like this:

local chest = peripheral.wrap("top")
local log = fs.open("log.txt","w")
for i=0,chest.getSizeInventory()-1 do
  log.writeLine("Slot "..i.." : "..chest.getStackInSlot(i).id)
end

log.close()

This will generate a text file called "log.txt" of every item ID in that particular chest.

If you are willing to use export/import busses to get items out of the network, you can use OpenCCSensors in order to get item names too. Say you've exported some cobblestone into slot 3 of a chest.


os.loadAPI("ocs/apis/sensor")
local openSensor = sensor.wrap("top") --#Assuming our CCSensor is on top of the computer
print("Slot 4: "..openSensor.getTargetDetails("-1,-1,0").Inventory[4].Name) --#I believe that is the syntax. You may need to do some checking as it has been a while sense I've used OpenCCSensors

The above program assumes that the chest that the cobblestone was exported into is at the coordinates (-1,-1,0) relative to the sensor. It would output: "Slot 4: Cobblestone".