259 posts
Posted 21 March 2013 - 12:53 PM
So im making a door into a mall with cc. I am using a i/o of redstone to make it. It checks for a redstone signal on the bottom and if it is true then it turns pistons off. My question. How do i make the program wait until there is a redstone signal.
8543 posts
Posted 21 March 2013 - 01:07 PM
os.pullEvent("redstone") will wait for any redstone change.
323 posts
Location
Boston, MA
Posted 21 March 2013 - 01:09 PM
Just so you know, you can do this with a "Memory Cell" in redstone logic…
Like this:
x = false
while x == false do
input = rs.getInput("SIDE")
if input == true then
x = true
while x == true do
rs.setOutput("SIDE TO PISTON", true)
b = rs.getInput("SAME SIDE AS INPUT")
if b == true then -- have a seperate wire that connects to this side, as with the INPUT variable
shell.run("programname")
end
end
end
end
259 posts
Posted 21 March 2013 - 01:30 PM
os.pullEvent("redstone") will wait for any redstone change.
Thank you thats all i needed. So with that i dont even need a redstone.getInput?
1511 posts
Location
Pennsylvania
Posted 21 March 2013 - 01:31 PM
No, once any redstone current is detected on ANY side, it will fire the event and return the parameters if any are specified.
997 posts
Location
Wellington, New Zealand
Posted 21 March 2013 - 03:24 PM
os.pullEvent("redstone") only waits for any redstone signal change, so you need to keep calling it, and check the signal each time, until you get the signal you want.