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

HELP! Please

Started by Randomrdp, 18 August 2012 - 08:35 PM
Randomrdp #1
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
cant_delete_account #2
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
Mikman21 #3
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.
Cranium #4
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.
Noodle #5
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).
Randomrdp #6
Posted 19 August 2012 - 09:12 AM
Thank you so much much it works awesomely and sorry for my terrible spelling