Broadcast message in a loop

  • Broadcast message in a loop doesn't work. It does work in a timer but that's slow for looping through multiple dynamic messages. I'm assuming it's the same as how behaviours with a duration other than 0 don't work in loops and timer(0s). I hope this can be changed.

    Also, I already previously posted this a while ago, but conditional loops still say "loop until {condition}" but actually do "loop while {condition}". E.g. "Loop until < 10" loops WHILE less than 10.

  • @Jack8680 Yea, Loop behaviour really should be allowed to have delays. Still finding myself using timer instead if Loop due to this.

  • Admin

    Sorry this got buried.

    This isn't actually a bug. Broadcast message does work in a loop, the thing is that if you put a both a loop and a receive message behaviour onto the canvas, they can be executed in any order. The problem occurs when the loop behaviour is executed before the receive message behaviour is.

    Solution: Put the loop and receive message behaviours into the same behaviour bundle, with the receive message executed before the loop behaviour.

  • @hamed What if I am broadcasting in a loop from one object, and I want to receive the message in a different object? Loop and receive can't be in the same bundle then. EDIT: Nevermind idk what this is talking about because I just tested exactly what I just said and it works fine. Broadcast a message 50 times in a loop, the other object received 50 messages.

  • @hamed yeah this is old, I think I made a post later saying I was wrong and made a mistake somewhere else that made it seem like it didn't work in a loop, was probably that the broadcast ran before receive was intitialised.

  • @jack8680 I hadn't realised this before... but this seems to mean it's possible to send unique messages to unique objects, like iterating over them.

    Which is kind of cool.

    Very messy to setup and test, but potentially powerful.

Log in to reply