Posted 12 September 2013 - 06:01 PM
I've been playing around with OpenPeripheral and I'm really excited about what its capable of. My main goal right now is to build a system that can A.) Modify my inventory with a PIM to unload items after mining B.) Modify items contained in a chest to either be auto-crafted or macerated / smelted.
Currently I'm working on getting the auto macerate / smelting going. I'm kind of stabbing blindly so I'm sure there are posts about how to do exactly this. By doing this my self though I hope to have a better understanding of what is capable with OP.
Right now I'm simply exploring what I can do with items in a chest. I've created a simple script that will run through each slot in a chest and dump its meta data into a table and print it.
Is there a way to avoid this hitch and have it chug along with identifying the rest of the items?
What would be your preferred method of dumping this information and making it a readable file? I know that you can use fs.open to create a file and write to it, but I haven't messed with it just yet.
Thanks!
Currently I'm working on getting the auto macerate / smelting going. I'm kind of stabbing blindly so I'm sure there are posts about how to do exactly this. By doing this my self though I hope to have a better understanding of what is capable with OP.
Right now I'm simply exploring what I can do with items in a chest. I've created a simple script that will run through each slot in a chest and dump its meta data into a table and print it.
slotnum = chest.getSizeInvantory()
chest.condense()
for i=,slotnum do
local tableInfo = chest.getStackInSlot(i)
for key, value in pairs(tableInfo) do
print(key .. " = " .. tostring(value))
end
print()
end
By running this I get a big dump of information, and I obviously can't read it all. However, it also bombs out when it hits an empty slot in a container with the error "script:5: bad argument: table expected, got nil"Is there a way to avoid this hitch and have it chug along with identifying the rest of the items?
What would be your preferred method of dumping this information and making it a readable file? I know that you can use fs.open to create a file and write to it, but I haven't messed with it just yet.
Thanks!