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

Why does this not work

Started by aileron565, 01 September 2012 - 02:21 AM
aileron565 #1
Posted 01 September 2012 - 04:21 AM
This is for a 13x15 tree farm.
Can someone please help me?
I am new to this.
Thx.


turtle.select(1)
up8()
layer()
layer()
layer()
layer()
layer()
layer()
layer()
layer()
function up8()
turtle.up()
turtle.up()
turtle.up()
turtle.up()
turtle.up()
turtle.up()
turtle.up()
end
function forward13()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
end
function layer()
row()
right()
row()
left()
row()
right()
row()
left()
row()
right()
row()
left()
row()
right()
row()
left()
row()
right()
row()
left()
row()
right()
row()
left()
row()
turtle.turnright()
forward13()
turtle.turnright()
forward13()
turtle.forward()
turtle.forward()
turtle.turnright()
turtle.turnright()
turtle.down()
end
function row()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
digg()
end
function right()
turtle.turnright()
turtle.forward()
turtle.turnright()
end
function left()
turtle.turnleft()
turtle.forward()
turtle.turnleft()
end
function.digg()
turtle.dig()
turtle.forward()
end
D3matt #2
Posted 01 September 2012 - 05:22 AM
What error messages does it give?
Luanub #3
Posted 01 September 2012 - 06:02 AM
The functions need to be above the code. Lua reads from top to bottom just like we do, if it hasn't read it, it doesn't know it exist.
aileron565 #4
Posted 01 September 2012 - 04:06 PM
Thx for your help! I will fix that. :)/>/>
dcleondc #5
Posted 01 September 2012 - 08:50 PM
i redid you code a little, here you go

function dig()
    turtle.dig()
    turtle.forward()
end
function left()
    turtle.turnLeft()
    turtle.forward()
    turtle.turnLeft()
end
function right()
    turtle.turnRight()
    turtle.forward()
    turtle.turnRight()
end
function row()
    forr=1,15 do
	    dig()
    end
end
function forward( num )
    for f=1,num do
	    turtle.forward()
    end
end
function up( num )
    for f=1,num do
	    turtle.up()
    end
end
function layer()
    for l=1,6 do
	    row()
	    right()
	    row()
	    left()
    end
    row()
    turtle.turnRight()
    forward(13)
    turtle.turnRight()
    forward(13)
    turtle.forward()
    turtle.forward()
    turtle.turnRight()
    turtle.turnRight()
    turtle.down()
end
  
turtle.select(1)
up(8)
for x=1,8 do
    layer()
end
Xhisor #6
Posted 01 September 2012 - 11:11 PM
LUA is case sensitive!
aileron565 #7
Posted 02 September 2012 - 02:58 AM
Thx dcleondc
dcleondc #8
Posted 02 September 2012 - 04:15 AM
Thx dcleondc
did the code work? because i did that on my ipod when i wasn't at my pc
aileron565 #9
Posted 03 September 2012 - 02:58 AM
Thx dcleondc
did the code work? because i did that on my ipod when i wasn't at my pc
when i posted that i was also on my ipod and didn't test it either. Sadly it didn't work. Can you help fix it? :D/>/>