User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: How To Exit Fast Loop

  1. #1
    Clicker Multimedia Fusion 2 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    drnebula's Avatar
    Join Date
    Jul 2006
    Location
    Pennsylvania, USA
    Posts
    908
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How To Exit Fast Loop

    Two questions. Let's say I'm in the middle of a fast loop and I want to that loop and start the next loop from the beginning.
    And at the end of a fast loop how can I have something happen, like opening another group? I've tried always, but the always happens before the loop finishes. I've tried if the loop index is equal to the final value, but that does nothing.
    Any help appreciated.
    Steve

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    You can stop a fastloop through the "stop loop" action, the cycle will continue to the very last "on loop" condition though.
    If you want to break a loop immediately, without performing following remaining "on loop" conditions,
    you can put it inside a group, and shut down the group when you want to break "immediately" the cycle.

    You can test the loopindex against number of loops, to see if the loop is iterating through the last cycle,
    perhaps your test didn't hold true because you compared loopindex = number of loops (i.e. you fired the loop 5 times, and compared loopindex=5)
    while you must compare loopindex = number of loops -1 (in above example, loopindex=4)
    since fastloops have "0" index

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by drnebula View Post
    And at the end of a fast loop how can I have something happen, like opening another group? I've tried always, but the always happens before the loop finishes.
    Steve
    I'm not sure I understand exactly what you're trying to do, but what you're describing here doesn't sound right. You can see in the below example that the 2nd and 3rd actions of event #4 (activating the "drink wine" group and running the "drink wine" fastloop) only happen after the first action (running the "remove the poison" loop) is completely finished. Otherwise, the poison would be 'consumed' and the application would end.


  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by drnebula View Post
    Two questions. Let's say I'm in the middle of a fast loop and I want to [end] that loop and start the next loop from the beginning.
    I was just wondering the same thing, and google led me here. I can't even remember making the previous post, in answer to your second question. But after reading @schrodinger 's reply and learning that closing a group is the only way to truly abort a loop, I have an answer for the first question. I'm posting it here for future googlers like me.

    Just to clarify. What I'm talking about (and what I believe drnebula also meant) is not about how to completely end a fastloop. But rather, we want to be able to force a loop to terminate its current iteration, and go immediately to the start of the next iteration.

    In my case, I wanted to do this to save a bit of CPU performance, as I have a very large fastloop with many dozens of events in it, most of which don't need to be checked every single time.

    Here's my solution, shown in the screenshot. I can confirm that using this method resulted in a measurable, though modest, speed increase in how long my fastloop took to execute. Loading my test level is now 22% (or about 30ms) faster. It's feasible that with a more complicated fastloop and/or a weaker PC, this could translate into a noticeable difference of, let's say, a third of a second or so.


  5. #5
    Clickteam Clickteam
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,645
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    You seem to be overcomplicating things... I made a simple MFA wherein line 3 (a simple "on loop" test) will only run IF the current loop iteration runs to completion (at which point it outputs the current iteration number to the string).

    Line 2 runs a test to say: if the current iteration of the loop = 2, then add 1 to the current loop index value.



    The output achieved is:



    If line 2 is disabled:



    Therefore, line 2, by setting the index 1 higher, is clearly terminating the rest of the loop iteration. There is no conditional test on line 3 - it is iteration agnostic and so if line 2 wasn't terminating the loop iteration, we would always see the "0, 1, 2, 3, 4," result.

    You can download the example MFA here:

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator
    SirEatAlot's Avatar
    Join Date
    Oct 2010
    Location
    Stockholm, Sweden
    Posts
    363
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    this is very interesting and useful to know!

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Feb 2014
    Posts
    976
    Mentioned
    16 Post(s)
    Tagged
    1 Thread(s)
    @Simon nice example simon, i never knew you could change the loop index on the go. definitely useful

    but unfortunately it appears that you have not actually skipped the loop cycle, but rather still completed it but just using a higher loop index number.

    i have included an example running a loop just once with an "end application" event on the last "on loop" line to prove that this method does not actually skip it.

    have fun trying to skip the "end application" event
    Attached files Attached files

  8. #8
    Clickteam Clickteam
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,645
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Ah, so it is. My bad.

  9. #9
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    Pity. That would indeed have been an awesome and very easy method.

  10. #10
    Clicker Fusion 2.5 Developer

    Join Date
    Feb 2014
    Posts
    976
    Mentioned
    16 Post(s)
    Tagged
    1 Thread(s)
    @Volnaiskra i know i was really hoping it worked, that would have been epic

    i would actually add that as a feature request, if the bug tracker still existed lol.

    actually maybe someone should start a cf2.5 feature request thread now that that area is gone. ( altho that could end up turning into a warzone like the old f3 thread )

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Game Of Life - Fast Loop = not that fast :)
    By bad_rick in forum Fusion 2.5
    Replies: 7
    Last Post: 20th June 2016, 08:36 PM
  2. Replies: 2
    Last Post: 27th May 2015, 03:00 PM
  3. Terminate fast loop mid-loop
    By JDWB in forum Fusion 2.5
    Replies: 8
    Last Post: 2nd November 2014, 05:14 PM
  4. fast loop and loop index
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th May 2010, 02:43 AM
  5. Fast loop within fast loop - platform game
    By Safe in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 16th April 2010, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •