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

[Lua]Wall building problem

Started by DigitalQR, 14 January 2013 - 06:43 AM
DigitalQR #1
Posted 14 January 2013 - 07:43 AM
My idea was to have a turtle who will go and build me a wall (I know there's probably a bunch of people who have already done this, but I wanted to program my own version) and I've encountered a problem; the turtle will only build 2 wide.
Any help?

print("How High?")
high = tonumber(read())
print("How Long?")
long = tonumber(read())
y = high
x = long
u = 0

while y>0 do
turtle.place()
turtle.up()
y = y-1
end

if y == 0 then
if x>0 then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.down()
x = x-1
u = high
end
end

while u>0 do
turtle.place()
turtle.down()
u = u-1
end

if u == 0 then
if x>0 then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.up()
x = x-1
y = high
return
end
end
zekesonxx #2
Posted 14 January 2013 - 08:00 AM
You need to encase it in a while not isFinished do, and set isFinished to false when it has been finished.
DigitalQR #3
Posted 21 January 2013 - 08:11 AM
I put it in and it didn't work. But, I rewrote the script with the if statement in and it worked fine. Thankyou.