A numerical for loop with run through the commands inside it the selected number of times so instead of doing something like this
i = 9
while i > 0 do
turtle.place.Down()
turtle.forward()
i =i-1
end
You can simply do, and it will iterate through the code 9 times.
for i=1, 9 do
turtle.place.Down()
turtle.forward()
end
numerical for loop breakdown is for var=1, num do
var is the variable that will increase with each increment, and the number following it is where you want to start the count.
for x=1, 5 do
print(x)
end
Will print:
1
2
3
4
5
on the screen.
num is the number of increments you want to run. You can just put a number or a var containing the number you want to increment.
There is a third argument that I rarely see used that would come after then num that is how much you want to increment by so(basically a step)
for x=1, 5, 0.5 do
print(x)
end
Would print:
1
1.5
2
2.5
3
Hope this helps some. The for loops are a lot more reliable then doing while loops and using your own math.
For what you are doing I would convert to for loops.
EDIT: It looks like you are missing a lot of code. There is nothing that ever turns and builds the other walls. Is this all of the code?
From what I can tell this is going to place 9 blocks, then move up 5 spaces and repeat over and over since o will never == 0.
Try this and see if it will do the trick. I just put it together and have not tested it but it should work.
for c=1, 5 do
turtle.up()
for a=1, 4 do
for x=1, 8 do
turtle.placeDown()
turtle.forward()
end
turtle.turnRight()
end
end