Posted 12 May 2015 - 02:58 PM
Hello all, i've got a problem in one of my function. I'm trying to take item from a chest to the turtle.
For that, i've made a for loop that will inspect the 16 inventory slot and suck() item from the chest if needed.
Here is my code
The thing that i don't understand is that the turtle print my "sake a coke" but doesnt seem to pick items. Is the for loop executing too fast for the suck to be effective ?
Thank you in advance.
For that, i've made a for loop that will inspect the 16 inventory slot and suck() item from the chest if needed.
Here is my code
function checkInventory()
for i=1,16,1 do
turtle.select(i)
if facing == NORTH and i < 4 then
turtle.turnLeft()
facing = facing + 3
else if facing == WEST and i > 3 then
turtle.turnRight()
facing = facing - 3
end
if turtle.getItemCount() > 0 then
inSlot = turtle.getItemDetail(i)
print(inSlot.count)
print(inSlot.name)
if inSlot.name == "minecraft:wheat_seeds" and inSlot.count < 2 then
print("sake a coke")
turtle.suck()
elseif inSlot.name == "minecraft:wheat" then
local count = turtle.getItemCount()
turtle.drop(count)
elseif inSlot.name == "minecraft:wheat_seeds" and i > 3 then
turtle.drop()
end
end
end
end
end
The thing that i don't understand is that the turtle print my "sake a coke" but doesnt seem to pick items. Is the for loop executing too fast for the suck to be effective ?
Thank you in advance.