5 posts
Location
the universe
Posted 18 August 2012 - 10:35 PM
i'm a bit of an idiot but i can't find what's wrong with this code
wallhieght=4
repeat
turtle.up()
counter2=2
repeat
turtle.turnLeft()
turtle.back()
counter1=5
repeat
turtle.back()
turtle.place()
counter1=counter1-1
until counter1<1
turtle.turnLeft()
turtle.back()
counter1=4()()
repeat
turtle.back()
turtle.place()
counter1=counter1-1
until counter1<1
counter2=counter2-1
until counter2<1
wallhieght=wallhieght-1
until wallhieght<1
it's for a turtle building a square 4x5 and it's not working at all PLEASE HELP
474 posts
Posted 18 August 2012 - 11:48 PM
This should fix it:
wallhieght=4
repeat
turtle.up()
counter2=2
repeat
turtle.turnLeft()
turtle.back()
counter1=5
repeat
turtle.back()
turtle.place()
counter1=counter1-1
until counter1<1
turtle.turnLeft()
turtle.back()
counter1=4
repeat
turtle.back()
turtle.place()
counter1=counter1-1
until counter1<1
counter2=counter2-1
until counter2<1
wallhieght=wallhieght-1
until wallhieght<1
3 posts
Posted 19 August 2012 - 01:14 AM
Change hieght to height, and that may fix your problem. You misspelled it, so i think thet might be why its not working.
3790 posts
Location
Lincoln, Nebraska
Posted 19 August 2012 - 01:30 AM
Change hieght to height, and that may fix your problem. You misspelled it, so i think thet might be why its not working.
Lua doesn't care about spelling when declaring a variable. When you say
msspelld = 5
and
misspelled = 5
As long as you refer back to that same exact spelling, you are going to get the right variable value. In this example, the two are different variables due to their spelling, but are equal values.
864 posts
Location
Sometime.
Posted 19 August 2012 - 05:02 AM
Change hieght to height, and that may fix your problem. You misspelled it, so i think thet might be why its not working.
Lua doesn't care about spelling when declaring a variable. When you say
msspelld = 5
and
misspelled = 5
As long as you refer back to that same exact spelling, you are going to get the right variable value. In this example, the two are different variables due to their spelling, but are equal values.
Yes if the vars are the same like that. But in most cases they aren't and Lua is strict about correct language.
misspelled = 5
msspelled = misspelled
That would be only way for it to work (still see no point to it).
5 posts
Location
the universe
Posted 19 August 2012 - 09:12 AM
Thank you so much much it works awesomely and sorry for my terrible spelling