This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KocoNeuts's profile picture

Loop Rednet

Started by KocoNeuts, 01 November 2017 - 01:39 PM
KocoNeuts #1
Posted 01 November 2017 - 02:39 PM
Hello everyone,

I've been trying to make a loop in a program, I want it to wait that my main computer sends the message "true" on protocol "tickets" and if it's the case, power up some redstone.

Here's the code :

while true do
  if rednet.isOpen() == false then
	rednet.open("top")
  end
  local senderId, message, protocol = rednet.receive("tickets")
  if message == "true" then
	redstone.setOutput("back", true)
	os.sleep(0.5)
	redstone.setOutput("back", false)
  end
end

Thank you for your help! :D/>
Lyqyd #2
Posted 02 November 2017 - 03:58 AM
Moved to Ask a Pro.
KingofGamesYami #3
Posted 02 November 2017 - 04:06 AM
What exactly is the problem?
Luca_S #4
Posted 02 November 2017 - 07:42 AM
Are you sending the message like this:
rednet.send(id, "true", "tickets")
or like this:
rednet.send(id, true, "tickets")
if it's the latter you need to remove the quotes around true in your if statement.