Posted 02 May 2013 - 04:55 AM
-- By Andy M
function rotate()
turtle.turnLeft()
if turtle.detect() == true then
turtle.back()
turtle.place()
turtle.turnLeft()
turtle.back()
placer()
else
turtle.turnRight()
turtle.turnRight()
turtle.back()
turtle.place()
turtle.turnRight()
turtle.back()
placer()
end
end
function itemCheck()
if turtle.getItemCount(1) <=5 then
for slot=2,16 do
turtle.transferTo(1, 3)
end
end
end
function placer()
while true do
turtle.place()
itemCheck()
if turtle.back() == false then
layer()
rotate()
end
end
end
end
function layer()
if turtle.back() == false then
turtle.turnRight()
if turtle.detect() == true then
turtle.turnRight()
else
turtle.turnLeft()
if turtle.detect() == true then
turtle.turnRight()
else
turtle.turnRight()
turtle.turnRight()
if turtle.detect() == true then
turtle.turnLeft()
turtle.up()
turtle.placeDown()
turtle.back()
turtle.placer()
else
turtle.turnRight()
end
end
end
end
end
print("This will run forever, even after it runs out of blocks")
print("Put filler blocks as many slots as you like, starting from slot 1")
print("Running Filler, hold CTRL + T for 1 second to terminate")
placer()
The program is meant to go a row at a time, instead it goes in a spiral and then it doesn't go up (refer to function layer())
any help would be nice as I can't see what i'm doing wrong?
thanks!