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

[first] basic turtle door

Started by Heroj04, 11 September 2012 - 09:46 PM
Heroj04 #1
Posted 11 September 2012 - 11:46 PM
This is my first practical program.
This program simply, when you press a button(or any redstone update) will make a hole in a wall, wait five seconds then build it back.

Note: the wall can only be made of one type of block ATM.

Anyway here you go
http://pastebin.com/hMRnu47r
NIN3 #2
Posted 11 September 2012 - 11:53 PM
Um, Did you atually try this code? I see it sets 3 functions, but never calls any of them……

Just saying, dont listen to my rambling.
Heroj04 #3
Posted 12 September 2012 - 12:01 AM
Um, Did you atually try this code? I see it sets 3 functions, but never calls any of them……

Just saying, dont listen to my rambling.

Damn it I made it on my turtle just rewrote it then on pastebin and forgot that fixing now

Fixed
Jahmaican #4
Posted 12 September 2012 - 12:06 AM
Yes, you propably missed "waiting()" at the very bottom.

The code itself could be better, but just to be able to use this with a wall made of different materials you could do this:

function closeDoor()

slot=1
turtle.select(slot)

turtle.forward()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.placeUp()
turtle.forward()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.placeUp()
turtle.back()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.place()
turtle.back()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.place()
waiting()
end

Looks very bad but should work, haven't tested it though. Of course it might crash if there's some items that you can't place in turtle's inventory, or if some of the blocks get lost somehow.
Heroj04 #5
Posted 12 September 2012 - 12:11 AM
Yes, you propably missed "waiting()" at the very bottom.

The code itself could be better, but just to be able to use this with a wall made of different materials you could do this:

function closeDoor()

slot=1
turtle.select(slot)

turtle.forward()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.placeUp()
turtle.forward()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.placeUp()
turtle.back()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.place()
turtle.back()

while turtle.getItemCount(slot)==0 do
slot=slot+1
turtle.select(slot)
end

turtle.place()
waiting()
end

Looks very bad but should work, haven't tested it though. Of course it might crash if there's some items that you can't place in turtle's inventory, or if some of the blocks get lost somehow.
Unfortunately I can't check because I'm not at my pc I'm on an iPad but thanks
xXLeNinjaXx #6
Posted 12 January 2014 - 02:54 PM
Heres an Install i was board xD

pastebin get uXcGtDuJ Install
Edited on 12 January 2014 - 01:54 PM
Buho #7
Posted 13 January 2014 - 12:13 PM
Heroj: That's a pretty cool door idea!