Posted 05 March 2013 - 05:56 AM
Hello all. I need to make a long wall in the ocean out of sand and thought programming a turtle would be a nice intro to turtle scripting.
I'm used to C# { open and closed } syntax, so I'm almost certain my issue is syntax based.
The idea is simple. Check slot one for sand, if no sand, move to a slot that has sand. Keep dropping sand below until a block is detected below, then move forward one block and repeat the process until i = 10.
It looks like it cycles through the inventory correctly, but fails on the while == false.
I'm used to C# { open and closed } syntax, so I'm almost certain my issue is syntax based.
The idea is simple. Check slot one for sand, if no sand, move to a slot that has sand. Keep dropping sand below until a block is detected below, then move forward one block and repeat the process until i = 10.
It looks like it cycles through the inventory correctly, but fails on the while == false.
s = 2 --slot number
turtle.select(1)
turtle.refuel()
for i=1,10 do
if turtle.detectDown() then
turtle.forward()
end
while turtle.detect.Down() == false do
if turtle.getItemCount(s) < 1 then s = s + 1
turtle.select(s)
turtle.placeDown()
end --end if
end -- end while do loop
end --end for loop