Posted 31 August 2012 - 04:28 PM
I'm having a problem working something out. I'm quite sure it's not very complicated, I'm just kinda new to computercraft.
I've made a piston controled 3x3 door, and a program for closing and opening it. This went without a hitch.
However, I want to burrow the computer underground, and connect it to a button on the outside, so that when you hit the button, the door opens. I've tried using a "while true do" command and pulling on the redstone event. This works for the first time the button is pushed. If I tried restarting the program at the end of itself, it no longer stoped to wait for a redstone input, and just kept opening. Thus, I would have to manually restart the program to make the design work, and I want this to funciton automatically.
Please help :)/>/>
Edit:
I simulated the sitaution with a redstone lamp for experimentation, and the program looks like this (and is ofcourse saved as startup)
I've made a piston controled 3x3 door, and a program for closing and opening it. This went without a hitch.
However, I want to burrow the computer underground, and connect it to a button on the outside, so that when you hit the button, the door opens. I've tried using a "while true do" command and pulling on the redstone event. This works for the first time the button is pushed. If I tried restarting the program at the end of itself, it no longer stoped to wait for a redstone input, and just kept opening. Thus, I would have to manually restart the program to make the design work, and I want this to funciton automatically.
Please help :)/>/>
Edit:
I simulated the sitaution with a redstone lamp for experimentation, and the program looks like this (and is ofcourse saved as startup)
event, back = os.pullEvent()
if event == "redstone" then
shell.run("on")
sleep(2.0)
shell.run("off")
os.reboot()
else
os.reboot()
end