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

[error] worldeater

Started by ewart4fun, 06 November 2012 - 09:19 AM
ewart4fun #1
Posted 06 November 2012 - 10:19 AM
i've made a worldeater program for a turtle.
but when i try to start it it sasy that end line 9 is to close to while line 5
can someone tell me what i'm doing wrong?
Spoiler
while true do
  os.pullEvent("redstone") -- wait for a "redstone" event
  if rs.getInput("back") then -- check the input
	while true do
	down = 0
	turtle.digDown()
	turtle.Down()
down = down + 1
until down == 50
turtle.dig()
turtle.forward()
up = 0
turtle.digUp()
turtle.up()
up = up + 1
until up == 50
turtle.dig()
turtle.forward()
   end
  end
end
end
end
Orwell #2
Posted 06 November 2012 - 10:29 AM
It is either

while ([condition]) do
  -- code block
end
or

repeat
  -- code block
until ([condition])

You got much too many ends and an if block and a loop that cross over (or something). Also, it's turtle.down(), not turtle.Down() :P/>/>
remiX #3
Posted 06 November 2012 - 10:51 AM
This should work :P/>/>


while true do
  os.pullEvent("redstone") -- wait for a "redstone" event
    if rs.getInput("back") then -- check the input
	    for i = 1, 50 do
            down = 0
            turtle.digDown()
            turtle.Down()
        end
        turtle.dig()
        turtle.forward()
        for i = 1, 50 do
            turtle.digUp()
            turtle.up()
        end
        turtle.dig()
        turtle.forward()
    end
end
ewart4fun #4
Posted 06 November 2012 - 07:46 PM
thanks, my code is working now :P/>/>