logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Execute and wait for behaviour bundle to finish

    Scheduled Pinned Locked Moved
    Help and Support
    3
    5
    213
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • KamdroidK
      Kamdroid
      last edited by

      Is there a way to execute (behaviour on) a behaviour bundle, and wait for it to finish running before continuing the main code.

      Example:
      91EA4E2E-323B-48A9-A0C7-D3B371298053.jpeg

      1 Reply Last reply Reply Quote 0
      • RobinsonXR
        RobinsonX
        last edited by

        Use broadcast message and receive message. They work like "functions" where code will only continue to run after all the code in the receive message behavior has been executed.

        Broadcast message to call an event (you can put parameters in it too!) and receive message to handle the event.

        1 Reply Last reply Reply Quote 0
        • Aidan_FireA
          Aidan_Fire
          last edited by Aidan_Fire

          How I’d do it: After the calculated result behaviour wherever it is, behaviour on the thing that does stuff with the calculated result. So you would disconnect Get Calculated Result and turn it off.
          FD287F69-0E80-418D-A0B8-548B5308BE85.png

          1 Reply Last reply Reply Quote 1
          • KamdroidK
            Kamdroid
            last edited by

            Since I'll be using the "calculate result" function multiple times in different places, I think the best option is:

            • Use broadcast/receive message. When using "calculate result", supply a parameter that says the name of the "receive message" key to activate (basically a callback function)

            Which is similar to the separated behaviour bundle + "behaviour on" technique.

            If I could dynamically supply the name of what behaviour bundle I want to activate, then I would choose to do that, since having multiple "receive message" might have a tiny performance impact.

            Aidan_FireA 1 Reply Last reply Reply Quote 0
            • Aidan_FireA
              Aidan_Fire @Kamdroid
              last edited by

              @Kamdroid Just after doing some testing, for me the game seems to always actually wait for the calculation to finish before moving on to the next behaviour under behaviour on anyway, even when calculate result had loops.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post