Message/mailbox input for Logic gates producing bad output

Message input for logic gate isn’t working well

http://www.flowlab.io/game/play/892343

For this example, look in object “cursor” toward the bottom under its movement stuff, the cursor will play annoying beep sounds while it’s off any blue square, but you’ll notice it won’t stop playing the sound. The NOR is using message input from a proximity sensor detecting a blue square in its grid, and its the message logic that’s messing it up. Just unwire the messages and hook the NOR directly to the proximity sensor and it will work (the NOR won’t output anything/the sound will turn off while on blue squares). In both cases it is the same input going to the NOR, but with messages the NOR’s output remains on.

This happens the same with messages being sent from other objects, and with NAND as well, I haven’t tested any of the other gates

So this behavior is going to be due to the message timing. Currently, the way messages work is that they are gathered up and delivered, then the mailboxes are all processed at the end of the frame. This prevents the possibility of creating infinite loops using mailboxes. In the situation we’re looking at here, the NOR gate is getting evaluated first each frame, then the message is arriving too late.

I’ve considered changing the mailbox behavior, since the timing isn’t super intuitive in cases like this, but if I make them process in-line, then it will be easy to create hard to find loops.

So the NOR goes first, sees there is no input, and evaluates as such, afterward the message arrives without affect the NOR, then the message stops outputting, the frame ends, and then this repeats the next frame and so on? I’m guessing the same timing issue applies for switches, when trying to turn it off as it’s receiving continuous input the switch is evaluated first and continues outputting. It helps to understand why it’s happening at least.

Well, message mailboxes are the only blocks that are gathered up an run at the end. All other triggers are run in left->right, top->bottom order like reading a book. So a switch will be evaluated when the trigger connected to it is evaluated.

If you’re having a switch problem, point it out to me in the game and I’ll take a look.