I'm still experimenting with CC and AE2 stuff to learn everything about lua and CC and it seems like its going into the right direction.
This time i'm trying to request the crafting of an item. The ME knows the recipe and everything should work.
The command to request some items is "requestCrafting". Infos from the documentation:
Spoiler
requestCrafting: Request the specified item to get crafted.
source: me_interface
returns:
args:
- (table)item: Details of the item you want to craft: { id, [ dmg, [nbt_id]] }
- (number)qty?: The quantity of items you want to craft
- (string)cpu?: The name of the CPU you want to use
The item and qty are no problem, but the CPU seems to be one.
First i need the name. It should not be a big deal because there is "getCraftingCPUs"
But the problem starts because none of the attached crafting CPU's have a name.
Spoiler
lua> me = peripheral.wrap("bottom")
lua> me.getCraftingCPUs()
{
{
name = "",
coprocessors = 0,
busy = false,
storage = 65536,
}
}
lua>
So because "requestCrafting" needs a name and the CPU doesnt have one, it cant work.
I tested to rename the CPU in an anvil and that seems to work.
Spoiler
lua> me = peripheral.wrap("bottom")
lua> me.getCraftingCPUs()
{
{
name = "test",
coprocessors = 0,
busy = false,
storage = 65536,
}
}
lua>
But now i still cant use "requestCrafting".
This is my current code:
Spoiler
me = peripheral.wrap("bottom")
list = me.getAvailableItems()
for number, item in pairs(list) do
if item.nbt_id == "4b6ccebf85c96dde4d085c3c4f064878" then
if item.qty >= 1 then
me.exportItem(list[number], 1, 0)
print("Exported")
else
me.requestCrafting(list[number], 1, "test")
print("Crafting")
end
end
end
If atleast one item with the correct nbt_id is inside the me everything works fine and it gets exported.
If not i just get that error and i cant find anything about it in this board/google.
test:11: use 'converter' env argument
I hope that someone here knows how to fix this error.
Sorry for my bad english, i hope its not to hard to understand.