This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AndyMcB1's profile picture

Filler program gone wrong

Started by AndyMcB1, 02 May 2013 - 02:55 AM
AndyMcB1 #1
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!
LordIkol #2
Posted 02 May 2013 - 06:00 AM
hm i dont see the logic in there
can you please tell exactly what this program is supposed to do?