r/ComputerCraft • u/BartyB • Nov 11 '16
Code question
I am assuming I can post help about code here since I don't see any rules against it. I am trying to write a program that will keep executing after it is done. My current code is.
redstone.setOutput("right",true)
while true do
os.pullEvent("redstone")
if rs.getInput("left") then
break
end
end
redstone.setOutput("right"),false)
os.sleep(2)
redstone.setOutput("back",true)
os.sleep(5)
redstone.setOutput("back",false)
os.sleep(2)
redstone.setOutput("right"true)so the code works perfectly but after that last line and it turns the right side back on. I want it to continue looking for a redstone input from the left side and execute again.. repeat. But right now the code just stops and nothing happens when redstone pulses the left side.
0
Nov 11 '16
[deleted]
0
u/BartyB Nov 11 '16
thank you for your suggestion. But legit I just put a reboot command at the end and then just set the program to run automatically at startup. Now it runs exactly the way I want it to lol.
0
1
u/eniallator Nov 11 '16
just wrap what you have, in an outer while loop