Author Topic: Event: fireRelayBack  (Read 2111 times)

This has probably been suggested dozens of times before, but here goes:

Basically, this is an event that will fire a relay back to whichever brick most recently sent it one.  For example:

Events for Brick 1:
  • onActivate - [Brick 2] - [fireRelay]
  • [0] onRelay -
[Self] - [playSound] [breakBrick]

Events for Brick 2:
  • onRelay - [Self] - [fireRelayBack]
  • [0] onRelay -
[Self] - [fakeKillBrick] [0 0 5] [10]

What this would do:  Brick 1 fires a relay to Brick 2 when clicked, which causes Brick 2 to fake kill and send a relay back to the most recent relay sender - in this case Brick 1.  There are several applications for something like this, with the most notable being the ability to handle user input when you do not know what that user will do, and handling it without the use of VCE conditionals or extra named bricks.

Feedback and suggestions are appreciated.
« Last Edit: May 30, 2010, 11:56:10 PM by Niliscro »

1st!

um, well, from a different viewpoint or next to it etc.

If far away, name the initial trigger brick and [NamedBrick] [fire relay]

If next to, use FireRelayNorth etc.

If far away, name the initial trigger brick and [NamedBrick] [fire relay]
the ability to handle user input when you do not know what that user will do, and handling it without the use of VCE conditionals or extra named bricks.

Also, if the one brick will be accepting input from multiple bricks it's not even as simple as naming those bricks.  You then have to make a new variable and modify it according to which brick sent input, then run conditionals in the receiving brick to determine which input brick to send a relay back to.

The fireRelayBack concept is basically that of a ping.
« Last Edit: May 30, 2010, 11:44:47 PM by Niliscro »


Confus
Brick 1 sends a relay to Brick 2.  Brick 3 sends a relay to Brick 2.  Some type of input causes Brick 2 to fireRelayBack, so it fires a relay to Brick 3, since it was the most recent brick to send a relay to Brick 2.

Get?


Wouldn't Brick 2 fire a relay back to brick 1 first?

Cough, seems like it's leading to drama...

How? He's explaining it to me...

Can be done with variables.


Can be done with variables.
Seriously, you people need to read.

Wouldn't Brick 2 fire a relay back to brick 1 first?
No, Brick 2 only sends a relay back to the most recent brick to send it one.  So if it were:

Events for Brick 1:
  • onActivate - [Brick 2] - [fireRelay]
  • [0] onRelay -
[Self] - [playSound] [breakBrick]


Events for Brick 3:
  • onActivate - [Brick 2] - [fireRelay]
  • [0] onRelay -
[Self] - [playSound] [breakBrick]


Events for Brick 2:
  • onActivate - [Self] - [fireRelayBack]
  • [0] onRelay -
[Self] - [fakeKillBrick] [0 0 5] [10]

When Brick 2 was activated, it sent a relay back to Brick 3, the most recent one to send Brick 2 a relay.  In the example I have in the OP, it would send it back onRelay which would always be to whichever brick sent that relay.

That SPLIT second before Brick 3 fires a relay, Brick 1 would be Brick 2's most recent relay...?

FxDTSBrick::onRelay(%this, %something?)
    %this.lastRelayBrick = something
    parent

FxDTSBrick::fireRelayBack(%this, %something)
    %this.lastRelayBrick.fireRelay();
   

That SPLIT second before Brick 3 fires a relay, Brick 1 would be Brick 2's most recent relay...?
No, because it's only onActivate - [Self] - [fireRelayBack] in that example, not onRelay.  if it was onRelay, then yes.

FxDTSBrick::onRelay(%this, %something?)
    %this.lastRelayBrick = something
    parent

FxDTSBrick::fireRelayBack(%this, %something)
    %this.lastRelayBrick.fireRelay();
   
What's the "%something?"