Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. Where does a Loop exit when done?

Where does a Loop exit when done?

Scheduled Pinned Locked Moved Help and Support
12 Posts 5 Posters 1.7k Views 3 Watching
  • 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.
  • D Deeeds

    If using a Loop Behaviour, on Conditional, and setting it to loop 10x through, where's the outpoint on the Behaviour when it's finished?

    Everything dragged off the bottom of the Behaviour is part of the loop's activity.

    And there's no other output. So how do I, after the 10x through the loop, continue onwards to do other things?

    Or are loops the end of the road?

    EDIT:

    I'm not expressing this well without programming guff....

    while i < 10
    { do this stuff... }
    i++
    ...Falls through to here once i = 10 and code continues onwards

    Where's the fall through (or release point) for a conditional loop in hyperPad?

    iTap DevelopmentI Offline
    iTap DevelopmentI Offline
    iTap Development
    wrote on last edited by
    #3

    @Deeeds maybe it would work to have an IF and BEHAVIOR ON at the end of the loop chain and have the IF be ‘i is less than 10’ or whatever the loops is going to. So then on the last time the loop runs the behavior on can trigger whatever you want to continue with. Or you could use a broadcast instead of behavior on.

    D 1 Reply Last reply
    1
    • KamdroidK Kamdroid

      @Deeeds I also don’t know.

      I just add a little delay (0.017 is the absolute lowest, thanks to Jack8680 for pointing this out) next to the start of the loop, and because the loop freezes the game until it’s finished, the delay will only finish once the loop has, thus running everything after the delay.

      0_1510964350746_0B0F158D-4B09-452A-B550-DE7709D7BA26.png

      D Offline
      D Offline
      Deeeds
      wrote on last edited by
      #4

      @Kamdroid Now THAT is hacky! Wow. What a bodgy workaround!

      1 Reply Last reply
      0
      • iTap DevelopmentI iTap Development

        @Deeeds maybe it would work to have an IF and BEHAVIOR ON at the end of the loop chain and have the IF be ‘i is less than 10’ or whatever the loops is going to. So then on the last time the loop runs the behavior on can trigger whatever you want to continue with. Or you could use a broadcast instead of behavior on.

        D Offline
        D Offline
        Deeeds
        wrote on last edited by
        #5

        @iTap-Development Nesting If's to get an exit! Nice! I feel so spoiled. I've come from using big, general purpose languages for a while, where there's more facilities than needed. Haven't had to think like this since I was a kid.

        We can only hope @hamed realises he shouldn't require this kind of behaviour (oh... pun) from his users.

        1 Reply Last reply
        0
        • D Deeeds

          If using a Loop Behaviour, on Conditional, and setting it to loop 10x through, where's the outpoint on the Behaviour when it's finished?

          Everything dragged off the bottom of the Behaviour is part of the loop's activity.

          And there's no other output. So how do I, after the 10x through the loop, continue onwards to do other things?

          Or are loops the end of the road?

          EDIT:

          I'm not expressing this well without programming guff....

          while i < 10
          { do this stuff... }
          i++
          ...Falls through to here once i = 10 and code continues onwards

          Where's the fall through (or release point) for a conditional loop in hyperPad?

          Jack de WildeJ Offline
          Jack de WildeJ Offline
          Jack de Wilde
          wrote on last edited by
          #6

          @Deeeds 0_1510971063690_IMG_0500.JPG

          First the behaviour named '1' will run, then '2' will repeat during the loop, then '3' will run when the loop finishes.

          D 1 Reply Last reply
          1
          • Jack de WildeJ Jack de Wilde

            @Deeeds 0_1510971063690_IMG_0500.JPG

            First the behaviour named '1' will run, then '2' will repeat during the loop, then '3' will run when the loop finishes.

            D Offline
            D Offline
            Deeeds
            wrote on last edited by
            #7

            @Jack8680 Another hack! Around. Literally, around the loop. Nice!

            Jack de WildeJ 1 Reply Last reply
            0
            • D Deeeds

              @Jack8680 Another hack! Around. Literally, around the loop. Nice!

              Jack de WildeJ Offline
              Jack de WildeJ Offline
              Jack de Wilde
              wrote on last edited by
              #8

              @Deeeds I think this was the intended way of using them, since the behaviours just activate in order.

              KamdroidK 1 Reply Last reply
              0
              • Jack de WildeJ Jack de Wilde

                @Deeeds I think this was the intended way of using them, since the behaviours just activate in order.

                KamdroidK Offline
                KamdroidK Offline
                Kamdroid
                wrote on last edited by
                #9

                @Jack8680 In the example I showed here, if I remove the delay, then the behaviour on will run before the loop finishes, and wrecks everything lol.

                Jack de WildeJ 1 Reply Last reply
                0
                • KamdroidK Kamdroid

                  @Jack8680 In the example I showed here, if I remove the delay, then the behaviour on will run before the loop finishes, and wrecks everything lol.

                  Jack de WildeJ Offline
                  Jack de WildeJ Offline
                  Jack de Wilde
                  wrote on last edited by
                  #10

                  @Kamdroid the behaviour on shouldn't run before the loop finishes.

                  I don't know what your project is, but I see you're using spawn on area. When an object is spawned, its behaviours don't run until the next tick; so if appLoader_Load is doing causing those spawned objects to run behaviours then you do need a delay, although it only needs to be 0.017s I think.

                  KamdroidK 1 Reply Last reply
                  2
                  • Jack de WildeJ Jack de Wilde

                    @Kamdroid the behaviour on shouldn't run before the loop finishes.

                    I don't know what your project is, but I see you're using spawn on area. When an object is spawned, its behaviours don't run until the next tick; so if appLoader_Load is doing causing those spawned objects to run behaviours then you do need a delay, although it only needs to be 0.017s I think.

                    KamdroidK Offline
                    KamdroidK Offline
                    Kamdroid
                    wrote on last edited by
                    #11

                    @Jack8680 Thank you, you’re correct; anything lower than 0.017 and it runs before loop finishes.

                    1 Reply Last reply
                    0
                    • MurtazaM Offline
                      MurtazaM Offline
                      Murtaza
                      Admin
                      wrote on last edited by
                      #12

                      As jack says it will trigger the next child of the parent behaviour.
                      This is by design, since it's how every other behaviour works. They trigger in order of left to right.

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Search