Jump to content




[lua][error][solved]problem with my opendoor program


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

#1 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 07 April 2013 - 06:59 AM

my opendoor program doesn`t work.
when i let it my turtle run, it says:''opendoor:1: attempt to call nil''.
i am a little bit a noob at coding.
here is the program i wrote:
RemoveDoor()
sleep(20)
PlaceDoor()

function RemoveDoor()
turtle.down()
turtle.dig()
turtle.down()
turtle.dig()
TwoUp()
end

function TwoUp()
turtle.Up()
turtle.Up()
end

function PlaceDoor()
turtle.down()
turle.place()
turtle.down()
turtle.place()
TwoUp()
end


#2 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 07 April 2013 - 07:02 AM

The functions need to be declared first:

function TwoUp()
turtle.Up()
turtle.Up()
end
function RemoveDoor()
turtle.down()
turtle.dig()
turtle.down()
turtle.dig()
TwoUp()
end
function PlaceDoor()
turtle.down()
turle.place()
turtle.down()
turtle.place()
TwoUp()
end
RemoveDoor()
sleep(20)
PlaceDoor()


#3 Telokis

  • Members
  • 88 posts
  • LocationToulouse, France

Posted 07 April 2013 - 07:02 AM

View PostJappards, on 07 April 2013 - 06:59 AM, said:

my opendoor program doesn`t work.
when i let it my turtle run, it says:''opendoor:1: attempt to call nil''.
i am a little bit a noob at coding.
here is the program i wrote:
RemoveDoor()
sleep(20)
PlaceDoor()

function RemoveDoor()
turtle.down()
turtle.dig()
turtle.down()
turtle.dig()
TwoUp()
end

function TwoUp()
turtle.Up()
turtle.Up()
end

function PlaceDoor()
turtle.down()
turle.place()
turtle.down()
turtle.place()
TwoUp()
end

You have to declare your functions before calling them ! ;)

EDIT : Ninja'ed !

#4 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 07 April 2013 - 07:06 AM

You practically coded it backwards :D I give you props for that (not making fun of you in any way, and yes, I am serious. I am very impressed)

#5 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 07 April 2013 - 07:17 AM

i wanted to make a hidden door inside a hollow (twilight forest) tree and (an original) turtledoor, and all you need is a mining turtle and this program and some blocks for the mining turtle to place.
this program is universal and to make the door look different al you need is to place a different block in the door frame.
i am one of those coders who write their scripts in chunks.
i am thinking about adding wireless redstone/modem functionality to it.
thanks, do you guys want a pastebin code of it?

#6 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 07 April 2013 - 08:12 AM

i posted this code(solved) in the turtle programs in the programs section:
http://www.computerc...-mining-turtle/





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users