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

Turtle moving program that i got stuck at

Started by corpusevp, 12 November 2012 - 01:22 PM
corpusevp #1
Posted 12 November 2012 - 02:22 PM
line 58 says attempt to call nil.. http://pastebin.com/mx9yd2n4
Orwell #2
Posted 12 November 2012 - 02:31 PM
Your first three functions are nested. So nbomb() is in down() which is in up() which is in forward(). This way, nbomb is only declared when all the other functions have been called. With a proper indentation, this would have been more obvious.
You have:

function forward(a)
for i = 0,a do turtle.forward()end
function up(^_^/>/>
for e = 0,b do turtle.up()end
function down(c)
for u = 0,c do turtle.down()end
function nbomb(:(/>/>
for i = 0,b do turtle.forward()end
   end
  end
end
end
Change that to:

function forward(a)
  for i = 0,a do
	turtle.forward()
  end
end

function up(:(/>/>
  for e = 0,b do
	turtle.up()
  end
end

function down(c)
  for u = 0,c do
	turtle.down()
  end
end

function nbomb(:(/>/>
  for i = 0,b do
	turtle.forward()
  end
end
:unsure:/>/>