Posted 07 September 2013 - 12:47 PM
I'm trying to make a turtle take out 640 items from a chest and once complete it will stop and do nothing until it receives a redstone pulse at which time it will take out another 640 items. I've been trying to work this out for several hours with no luck. I have gotten to a point in which it counts out the items and drops them, but once it reaches 640 it just does nothing at all. Any help will be greatly appreciated, thanks.
count = 0
function counting()
count = count + turtle.getItemCount(1)
return count
end
function countreset()
count = count - count
return count
end
while true do
sleep(0)
if count < 640 then
turtle.suck()
counting()
print(count)
turtle.drop(64)
sleep(0.4)
elseif count > 640 then
sleep(0)
if redstone.getInput("back",true) then
countreset()
print("Count has been reset.")
end
end
end