Posted 27 March 2013 - 05:19 AM
Hello,
I'm very new to programming and I am trying to write a program to fill in the top layer of a quarry. So far I can get it to place the first row of blocks, but for some reason it won't run it's second part. I think it has to do with the if then for blockDown and noblockDown but I'm not sure what I need to change since it's useing a Boolean string my only choices are true/false.
also here's a pastebin link [html]http://pastebin.com/GpeQWDAp[/html]
Edit: I forgot to mention that when I combine the noblockDown() and blockDown() it gives the error "filler:2: Too long without yielding
I'm very new to programming and I am trying to write a program to fill in the top layer of a quarry. So far I can get it to place the first row of blocks, but for some reason it won't run it's second part. I think it has to do with the if then for blockDown and noblockDown but I'm not sure what I need to change since it's useing a Boolean string my only choices are true/false.
function needsFuel()
if turtle.getFuelLevel() < 10 then
return true
else
return false
end
end
function refuel()
turtle.select(16)
turtle.refuel(1)
end
function invCheck()
for slot = 1, 15 do
if turtle.getItemCount(slot) == 0 then
slot = slot + 1
turtle.select(slot)
end
end
end
function noblockDown()
while turtle.detectDown() == false do
invCheck()
turtle.placeDown()
turtle.forward()
end
end
function blockDown()
while turtle.detectDown() ~= false do
turtle.turnRight()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
function fill()
if needsFuel() then
refuel()
end
if noblockDown() == false then
blockDown()
end
end
turtle.select(1)
while true do
fill()
end
also here's a pastebin link [html]http://pastebin.com/GpeQWDAp[/html]
Edit: I forgot to mention that when I combine the noblockDown() and blockDown() it gives the error "filler:2: Too long without yielding