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

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

Started by Jappards, 07 April 2013 - 05:59 AM
Jappards #1
Posted 07 April 2013 - 07: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
1lann #2
Posted 07 April 2013 - 08: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()
Telokis #3
Posted 07 April 2013 - 08:02 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

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

EDIT : Ninja'ed !
SuicidalSTDz #4
Posted 07 April 2013 - 08: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)
Jappards #5
Posted 07 April 2013 - 08: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?
Jappards #6
Posted 07 April 2013 - 09:12 AM
i posted this code(solved) in the turtle programs in the programs section:
http://www.computercraft.info/forums2/index.php?/topic/11912-hidden-door-program-mining-turtle/