User Tag List

Results 1 to 7 of 7

Thread: How to loop through objects!

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Iceland
    Posts
    478
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to loop through objects!

    Hi

    There is some time since I last used MMFD2 and I have forgotten many things. IN VB I would say:

    For i = 0 to 99
    object(i).value = rnd(60)
    next

    Hoe do I do this in MMFD2. I Have 100 objects and I want to place a different random number in each Alterable Value A. I used Duplicate when I created them.

    Keli

  2. #2
    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
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    You can just do:
    Start of Frame >>> Set 'Value' of 'Object' to random(60)

    You can also use fastloops / foreach

    Start of Frame >>> Spread ID of Object 0 ; Start loop 'loop' 'Number of 'Object's' times
    On loop 'loop' + ID of Object = loopIndex >>> Set 'Value' of 'Object' to random(60)

    Or if you have fusion 2.5 you could do foreach:

    Start of Frame >>> Foreach of Object
    On foreach of Object >>> Set 'Value' of 'Object' to random(60)
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Iceland
    Posts
    478
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Thanks for your reply. I had already tried your firsth suggestion. But then I always get the same random value in them all. Now I will try to use fast loops.

    Keli

  4. #4
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    To translate your VB code exactly into MMF you would do:

    Start of Frame
    Spread Value 0 through ObjectA

    [Trigger Condition]
    Set Global Value A: Random(60)

    ObjectA(AltValueA=Global ValueA)
    Do Some Actions

    Edit: Woops. Didn't read the last part of your post. You could create a 'pool' of random numbers and then assign on the first condition above ^, preferably using Bartek's method of ForEach Object and just iterate the once.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Iceland
    Posts
    478
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Thanks for your help. I ended up by using clone rather than duplicate. Then I end up with 100 objects. I then used a Group. Then at the start of the frame I set the Alterable Value of A of the group to random(60) and they all get differnet random numbers!

    Keli

  6. #6
    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
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I do not recommend that (since if you update one, all of them have to be deleted and cloned again.)
    But if you're happy with it, go ahead ^^
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Iceland
    Posts
    478
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi

    I was wrong! You are correct Bartek Biszkont! This is just what I needed as you suggestedd. Start of Frame >>> Set 'Value' of 'Object' to random(60)

    Sorry

    Keli

    I was looking at a wrong Alternate value

Similar Threads

  1. Replies: 7
    Last Post: 25th December 2012, 11:26 AM
  2. Picking Single Objects and Fast Loop Trouble
    By Kid_Roleplay in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 9th September 2009, 01:25 AM
  3. Create objects next to each other loop
    By Raylax in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 10th December 2008, 06:16 PM
  4. Access different objects from a loop
    By TheMagician in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 30th March 2008, 02:53 PM
  5. (Help) creating objects durring a fast loop and...
    By nightofgrim in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th July 2006, 06:46 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
  •