What are logic_relays for?

Avatar
Sliipperi
30 Posts
Posted May 20, 2011
I've been thinking why the pros (and other mappers) use them. On the wiki it says they are message forwarders. Couldn't I just do this: Button(output) -> Door(input)
Advertisement
Registered users don’t see ads! Register now!
Avatar
Aldéz
221 Posts
Posted May 20, 2011
Replied 1 hour later
I've seen in the example maps that they relay the button outputs. I don't know either why do it that way. On some occasions though, you may have several entities making the same outputs. Then it is a good idea to place all those outputs in a single relay.
Avatar
msleeper
4,136 Posts
Admin
Posted May 20, 2011
Replied 1 hour later
One of the major benefit of using a logic_relay is that they can be Enabled or Disabled, effectively cutting off the I/O flow when needed. So let's say that the door in question needs to be "powered up", or in some way is Disabled until some certain case applies. I could simply Disable the relay without having to worry about any other negative effects of Disabling the button.

I would like to make a point that, in the case of using multiple buttons to open a single door, a logic_relay is not the best solution. You would want to look into logic_branch and logic_branch_listener.

It's also a matter of neatness, so your entities aren't super cluttered with I/O. Using your example, when I push the button not only do I have the door open, but I also play a sound and toggle indicator strips and do any number of other things. I can put all of these effects into a single logic_relay, and tell my button to Trigger the relay, instead of each of the individual Outputs.

Avatar
ChickenMobile
2,460 Posts
Posted May 20, 2011
Replied 7 minutes later
I mainly use them to cut down the I/O clutter when you need a button or a trigger to fire multiple times and do the same thing.

Just like math_counter's logic_case's and logic_timer's: these are one of the most common entities you would be using for maps with loads of I/O and scripting.

Avatar
Nacimota
345 Posts
Posted May 20, 2011
Replied 14 minutes later

chickenmobile wrote:
I mainly use them to cut down the I/O clutter when you need a button or a trigger to fire multiple times and do the same thing...

Yup. It essentially does for source mapping what subroutines do for programming languages.

Avatar
Aldéz
221 Posts
Posted May 20, 2011
Replied 1 hour later

msleeper wrote:
It's also a matter of neatness, so your entities aren't super cluttered with I/O. Using your example, when I push the button not only do I have the door open, but I also play a sound and toggle indicator strips and do any number of other things. I can put all of these effects into a single logic_relay, and tell my button to Trigger the relay, instead of each of the individual Outputs.

Hmm, in the case of a button simply opening a door or similar cases, it would just add complexity to use a relay. So I'd rather say it's a matter of modularity rather than neatness.

Avatar
Sliipperi
30 Posts
Posted May 20, 2011
Replied 51 minutes later
You guys are so wise. Thanks for the info - I think I'm gonna use them from now on. :smile:
Advertisement
Registered users don’t see ads! Register now!
Avatar
Hober
1,180 Posts
Posted May 20, 2011
Replied 7 hours later

Sliipperi wrote:
You guys are so wise. Thanks for the info - I think I'm gonna use them from now on. :smile:

:potd: