User Tag List

Results 1 to 6 of 6

Thread: Is it a feature that "For Each" iterates through instances selected by the event?

  1. #1
    Clicker Fusion 2.5Fusion 2.5+ DLC

    Join Date
    Jun 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is it a feature that "For Each" iterates through instances selected by the event?

    I just noticed that and I am not sure whether that is the intended behavior (and I hope so as it makes sense, yet I cannot find any documentation):

    If an event selects objects (like Enemy collides Enemy), the ForEech enemy only iterates through those two enemies.

    If the object is not selected by the event (like Timer>0), then all Enemies are iterated with ForEach enemy.

    I ask as I have seen so many answers where people state "it goes through all instances".

  2. #2
    Clicker Fusion 2.5Fusion 2.5 Mac
    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)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    787
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)
    I would suppose so, since you are scoping down to the ones colliding it has no reason to go further than those two objects.

  3. #3
    Clicker Fusion 2.5 Mac
    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)

    Join Date
    Jan 2015
    Location
    Australia
    Posts
    189
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Blizna View Post
    If an event selects objects (like Enemy collides Enemy), the ForEech enemy only iterates through those two enemies.

    If the object is not selected by the event (like Timer>0), then all Enemies are iterated with ForEach enemy.
    Yeah the for-each loop will only run on the two objects affected by the collision (or whatever objects were scoped down by the initial conditions).

    If you wanted to go outside that scoping but still have the event trigger from something like a collision (e.g. when two objects collide you wanted *all* of those objects to be destroyed, not just the two individual objects), you could separate it out to a regular fast loop in a separate line which will ignore the scoping

  4. #4
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    622
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Yes, that's the intended effect.
    Since For each loops are actions within an object. Only those currently scoped will execute it.

    E.g. Event that doesn't have any "Active 2" conditions. It is assumed that all "Active 2"s will be affected by given actions.
    Event that does have conditions for "Active 2". Only "Active 2"s that pass that conditions will execute the actions.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/7RNXFrC
    Dungeon Raiders! - Link soon™

  5. #5
    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)

    Join Date
    May 2014
    Posts
    10
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Aww, is this stemming from my question? Flattered. For the longest time (until you showed me otherwise yesterday, actually), I assumed ForEach was just a more convenient way to fast-loop through objects...and I guess I assumed this because, like you said, it's not clearly documented anywhere I could find. It makes a lot of sense, in retrospect, but I'd definitely add it to any "tips and tricks" lists.

  6. #6
    Clicker Fusion 2.5Fusion 2.5+ DLC

    Join Date
    Jun 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by north View Post
    Aww, is this stemming from my question? Flattered. For the longest time (until you showed me otherwise yesterday, actually), I assumed ForEach was just a more convenient way to fast-loop through objects...and I guess I assumed this because, like you said, it's not clearly documented anywhere I could find. It makes a lot of sense, in retrospect, but I'd definitely add it to any "tips and tricks" lists.
    Indeed it is, I realized I was not sure whether the solution I suggested to your problem - although working well - is intended to be working that way. Happy to know it is.

Similar Threads

  1. Replies: 0
    Last Post: 19th August 2017, 01:46 PM
  2. "Close window selected" causes freeze with HTML5
    By Allrounder in forum HTML5 Export Module 2.5
    Replies: 6
    Last Post: 9th May 2014, 06:45 AM
  3. Feature Request: Keep Selected Location when Sorting by Object in Event Editor
    By knpmaster in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 22nd August 2012, 08:10 AM
  4. Paid job for porting "selected object" for IOS:
    By Pedro Almeida in forum Extension Development
    Replies: 0
    Last Post: 8th August 2011, 09:45 PM
  5. Multiple "copy/Pasted" instances?
    By GameDevs in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 2nd July 2010, 03:42 PM

Posting Permissions

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