31 posts
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
55 posts
Location
Everywhere.
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.
31 posts
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
23 posts
Location
Poland
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.
31 posts
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
31 posts
Posted 12 January 2014 - 02:54 PM
Edited on 12 January 2014 - 01:54 PM
110 posts
Posted 13 January 2014 - 12:13 PM
Heroj: That's a pretty cool door idea!