im beginner for both programming and lua, and now planning to make an 'multi alloy smelter controller'
before i make controller, im trying to make chest checking program for moving items from chest to machines
i try to use 'ore dictionary' for check there is right ingredient in chest
long story short, my program doesnt work, and i dont know why :/
here is my code:
local chest = peripheral.wrap("left") -- where chest is
local alloy = peripheral.wrap("alloy_smelter_0") -- due to modem cant be attached on chest, i connected smelter with wired modem
local chestsize = chest.getInventorySize()
for i=1,chestsize do
chestcheck = chest.getStackInSlot(i) -- check all inventory slot if chestcheck["ore_dict"]["oreGold"] == true then -- check whether gold or not
chest.pushItem("bottom",chestcheck["ore_dict"]["oreGold"],chestcheck[qty]) -- send gold if found end end
Then you do a loop (does this need to be indented?) from 1 to the size of the chest. on a normal single chest from vanilla, what would chest.getInventorySize() give? From 1 to the size of the chest (if chest.getInventorySize() doesn't start the count at zero) it should check every available inventory slot.
Again it's not indented, but that if should only pick out gold bars.
Still not indented, it should push it out? Why are you using gold again - if you already have checked it, there should only be gold ingots, unless the push command requires you to specify an item?
Then you end the if loop then the for loop.
G2g somewhere soon, but I'd check the syntax - sorry If I couldn't help much.