Posted 26 October 2013 - 06:36 PM
Title:Using a turtle to milk a cow
I am trying to use a turtle to milk a cow so that i can automate the collection of milk. So far i have been able to get most of it working the only think i cant get to work is the filling of the filling of the buckets.
The problem is when it sucks buckets because they now stack it can pick up more then one, i dont know how to make it only suck one or the way i was trying to get it to work was to count how many buckets it has then milk the cow the right amount of times depending on the amount of buckets.
here is my code please don't judge me i'm new to this so it might be a bit messy :P/>
function suck()
while not turtle.suck() do
sleep(1)
end
end
function getBucket()
turtle.turnLeft()
suck()
turtle.turnRight()
end
function dropMilk()
turtle.turnRight()
turtle.turnRight()
for vSlot = 1, 16, 1 do
turtle.select(vSlot)
turtle.drop()
end
turtle.turnLeft()
turtle.turnLeft()
end
function milk()
turtle.select(1)
turtle.getItemCount(1) = i
for i do
turtle.place()
end
while true do
getBucket()
milk()
dropMilk()
sleep(1)
end
I am trying to use a turtle to milk a cow so that i can automate the collection of milk. So far i have been able to get most of it working the only think i cant get to work is the filling of the filling of the buckets.
The problem is when it sucks buckets because they now stack it can pick up more then one, i dont know how to make it only suck one or the way i was trying to get it to work was to count how many buckets it has then milk the cow the right amount of times depending on the amount of buckets.
here is my code please don't judge me i'm new to this so it might be a bit messy :P/>
function suck()
while not turtle.suck() do
sleep(1)
end
end
function getBucket()
turtle.turnLeft()
suck()
turtle.turnRight()
end
function dropMilk()
turtle.turnRight()
turtle.turnRight()
for vSlot = 1, 16, 1 do
turtle.select(vSlot)
turtle.drop()
end
turtle.turnLeft()
turtle.turnLeft()
end
function milk()
turtle.select(1)
turtle.getItemCount(1) = i
for i do
turtle.place()
end
while true do
getBucket()
milk()
dropMilk()
sleep(1)
end