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

Can someone troubleshoot please?

Started by Blueknight1758, 20 November 2012 - 06:26 AM
Blueknight1758 #1
Posted 20 November 2012 - 07:26 AM
I used a program on this website called 'streetbuilder' and have edited it.
I am trying to make the turtle return to where it started at the end of the program using the last bit of this code below.
Spoiler

lua
=
print("How many times?")
a=tonumber(read())
x=1
while x<=a do
turtle.digDown()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.digDown()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnRight()
x=x+1
end

when x==a do
turtle.turnRight()
turtle.turnRight()
turtle.forward(a)
end
This generates the error

bios:338: [string "platform"] :24: '=' expected.
line 24 is "when x==a do"
what I would like to know is where i am going wrong or is there a better way to do it?
bjornir90 #2
Posted 20 November 2012 - 09:23 AM
Wrong section. Post it in ask a pro please :(/>/> and post the entire code on pastebin
Jasonfran #3
Posted 20 November 2012 - 10:21 AM
Remove the
Lua =
bit :s

And turtle.forward() needs no parameters
Cruor #4
Posted 20 November 2012 - 06:40 PM
Moved to ask a pro.
remiX #5
Posted 20 November 2012 - 06:55 PM
Didn't you post a topic about this? 'When x == a do' is not a valid loop. Use while.