Jump to content




I'm new to computercraft please help.


  • You cannot reply to this topic
2 replies to this topic

#1 chardo440

  • Members
  • 29 posts

Posted 07 October 2012 - 02:12 AM

function dig()
   for i=1, 75 do
   turtle.dig()
   turtle.digUp()
   turtle.forward()
end
function refuel()
   turtle.select(1)
   turtle.refuel(5)
end
function turn()
   turtle.left()
   turtle.left()
end
function back()
   for i=1, 75 do
   turtle.forward()
end
function torch()
   for i=1, 7 do
   turtle.select(2)
   turtle.placeDown(2)
end
function cleartext()
   term.clear()
   holder("My Miner ", 1,1
   term.setCursorPos(1,3)
end
function holder(string, columnVar,rowVar)
   term.setCursorPos(columnVar, rowVar)
   write (string)
end
end
end
end
cleartext()
print("Welcome to this unworking program! ")
sleep(1)
cleartext()
print("Lets get started")
sleep(1)
print("Starting...")





It tells me that I'm trying to call nil or something when it's supposed to start it's cleartext() function? what did I do wrong?

#2 chiloxsan

  • Members
  • 56 posts
  • LocationVictoria, AUS

Posted 07 October 2012 - 02:37 AM

function dig()
   for i=1, 75 do
    turtle.dig()
    turtle.digUp()
    turtle.forward()
   end
end
function refuel()
   turtle.select(1)
   turtle.refuel(5)
end
function turn()
   turtle.left()
   turtle.left()
end
function back()
   for i=1, 75 do
    turtle.forward()
   end
end
function torch()
   for i=1, 7 do
    turtle.select(2)
    turtle.placeDown(2)
   end
end
function cleartext()
   term.clear()
   holder("My Miner ", 1,1)
   term.setCursorPos(1,3)
end
function holder(string, columnVar,rowVar)
   term.setCursorPos(columnVar, rowVar)
   write(string)
end
cleartext()
print("Welcome to this unworking program! ")
sleep(1)
cleartext()
print("Lets get started")
sleep(1)
print("Starting...")

I have detected that you do not close off your for loops. When calling any type of loop, make sure you close off the block you want to repeat with an end statement.
Since you did not close off your for loops, the Lua interpreter did not define your cleartext() function. Also, you forgot the closing bracket on your call to holder in the cleartext() function.

#3 chardo440

  • Members
  • 29 posts

Posted 07 October 2012 - 02:48 AM

I got it working thank you so much.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users