Jump to content




How do i make a program wait before x == true


  • You cannot reply to this topic
5 replies to this topic

#1 AnDwHaT5

  • Members
  • 244 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.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 March 2013 - 01:07 PM

os.pullEvent("redstone") will wait for any redstone change.

#3 ebernerd

  • Members
  • 262 posts
  • LocationBoston, 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


#4 AnDwHaT5

  • Members
  • 244 posts

Posted 21 March 2013 - 01:30 PM

View PostLyqyd, on 21 March 2013 - 01:07 PM, said:

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?

#5 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

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.

#6 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, 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.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users