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

[Error] "=" expected at line 47, unable to find problem.

Started by Blocker226, 14 March 2012 - 02:32 AM
Blocker226 #1
Posted 14 March 2012 - 03:32 AM
I keep getting weird errors when I run the program "house". I'm trying to make the turtle build a simple house. That is all. But after I tweaked and added code to it for the 2nd layer (1st layer went fine), it gives me an error in line 47. It expects an "=". I tried doing all sorts of things to the line, adding "=" or extra "end"s. Can some one point out the missing block of code that gives the error? Here is the entire code:
Spoiler
for n=1,5 do
 turtle.back()
 turtle.place()
end
turtle.turnLeft()
for n=1,5 do
 turtle.back()
 turtle.place()
end
turtle.turnLeft()
for n=1,5 do
 turtle.back()
 turtle.place()
end
turtle.turnLeft()
for n=1,4 do
 turtle.back()
 turtle.place()
end
turtle.up()
turtle.placeDown()
turtle.back()
turtle.turnLeft()
for n=1,3 do
 for m=1,2 do
  turtle.back()
  turtle.place()
 end
 turtle.select(2)
 for m=1,2 do
 turtle.back()
 turtle.place()
 end
 turtle.select(1)
 turtle.back()
 turtle.place()
 turtle.turnLeft()
end
for n=1,2 do
 turtle.select(1)
 turtle.back()
 turtle.place()
end
 turtle.select(2)
for n=1,2 do
 turtle.back
 turtle.place()
end
turtle.up()
turtle.select(1)
turtle.placeDown()
turtle.back
turtle.turnLeft()
for n=1,5 do
turtle.back()
turtle.place
end
turtle.turnLeft()
end
Hawk777 #2
Posted 14 March 2012 - 04:49 AM
Line 47: turtle.place should be turtle.place()
kamnxt #3
Posted 14 March 2012 - 02:39 PM
"turtle.back" should be "turtle.back()", "turtle.place" should be "turtle.place()"
the "end" at the end didn't end anything…
Here's the modified program (i also fixed it not building the third layer completely) :
Spoiler

for n=1,5 do
turtle.back()
turtle.place()
end
turtle.turnLeft()
for n=1,5 do
turtle.back()
turtle.place()
end
turtle.turnLeft()
for n=1,5 do
turtle.back()
turtle.place()
end
turtle.turnLeft()
for n=1,4 do
turtle.back()
turtle.place()
end
turtle.up()
turtle.placeDown()
turtle.back()
turtle.turnLeft()
for n=1,3 do
for m=1,2 do
  turtle.back()
  turtle.place()
end
turtle.select(2)
for m=1,2 do
turtle.back()
turtle.place()
end
turtle.select(1)
turtle.back()
turtle.place()
turtle.turnLeft()
end
for n=1,2 do
turtle.select(1)
turtle.back()
turtle.place()
end
turtle.select(2)
for n=1,2 do
turtle.back()
turtle.place()
end
turtle.up()
turtle.select(1)
turtle.placeDown()
turtle.back()
turtle.turnLeft()
for m=1,4 do
for n=1,5 do
turtle.back()
turtle.place()
end
turtle.turnLeft()
end
turtle.up()
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
It builds a house that looks like this:
Spoiler[=] = slot 1, [o] = slot 2
[=][=][=][=][=][=]
[=][=][o][o][=][=]
[=][=][=][=][=][=]
Blocker226 #4
Posted 14 March 2012 - 02:49 PM
Line 47: turtle.place should be turtle.place()
Thanks! That was just what I needed.
"turtle.back" should be "turtle.back()", "turtle.place" should be "turtle.place()" the "end" at the end didn't end anything… Here's the modified program (i also fixed it not building the third layer completely) :
Spoiler
 for n=1,5 do turtle.back() turtle.place() end turtle.turnLeft() for n=1,5 do turtle.back() turtle.place() end turtle.turnLeft() for n=1,5 do turtle.back() turtle.place() end turtle.turnLeft() for n=1,4 do turtle.back() turtle.place() end turtle.up() turtle.placeDown() turtle.back() turtle.turnLeft() for n=1,3 do for m=1,2 do turtle.back() turtle.place() end turtle.select(2) for m=1,2 do turtle.back() turtle.place() end turtle.select(1) turtle.back() turtle.place() turtle.turnLeft() end for n=1,2 do turtle.select(1) turtle.back() turtle.place() end turtle.select(2) for n=1,2 do turtle.back() turtle.place() end turtle.up() turtle.select(1) turtle.placeDown() turtle.back() turtle.turnLeft() for m=1,4 do for n=1,5 do turtle.back() turtle.place() end turtle.turnLeft() end turtle.up() turtle.placeDown() turtle.turnLeft() turtle.forward() 
It builds a house that looks like this:
Spoiler[=] = slot 1, [o] = slot 2 [=][=][=][=][=][=] [=][=][o][o][=][=] [=][=][=][=][=][=]

Cool! My house is going to be more complicated though. :mellow:/>/>

Thanks guys for your help!