User Tag List

Results 1 to 5 of 5

Thread: Yet another Loop question

  1. #1
    No Products Registered

    Join Date
    Feb 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Yet another Loop question

    Is there a method or different extension to use to have 3 nested loops still reference each other.

    I want to:

    Run Loop "A" 2 times
    Loop "A" = Run Loop "B" 3 times
    Loop "B" = Run Loop "C" 4 times
    Loop "C" = write a value GetLoopIndex(A) + GetLoopIndex(B) + GetLoopIndex(C)


    I want to create a slew on numbers saved in an array that would look like 111, 112, 113, 114, 121, 122, 123, 124, etc.

    I am getting some odd results. Does reference the loop indexes work like this?

    Thank you,

    Tom / Doc4

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Yet another Loop question

    From looking at your last line, the value written would be the sum of the three loop indices, rather than a string made up of their values - to get this, use:

    Val(Str$(GetLoopIndex(A)) + Str$(GetLoopIndex(B)) + Str$(GetLoopIndex(C)))

    Other than that, you seem to be using nested loops the right way - the nested loops will behave how you expect.

  3. #3
    No Products Registered

    Join Date
    Feb 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Yet another Loop question

    Thanks for the quick response. I'll keep plugging away. That loop structure is what I have in place, but slathered in tons of arrays being written. It's encouraging to hear that the loops indexes will work as I intend.

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    682
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Yet another Loop question

    Don't forget it's 0 based.

  5. #5
    No Products Registered

    Join Date
    Feb 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Yet another Loop question

    Three more barely related questions so I don't flood the board with new threads.

    1) I can randomly pick a number 1-10 without any duplicates. I use MagicDeque to assign its elements the numbers 1-10, shuffle and then pick. Everything works fine. However, I REALLY want to pick an x,y location on a 3by3 grid without any duplicates. Any suggestions on how to do this? Pick random(3) by random(3) without duplicate grid location?


    2) I am pasting a gazillion actives to the background and deleting them. Background looks great, only a handful of actives left in play. If I Alt-Tab out and then back in, the pasted background disappears and only the original flood-fill grey remains. I hope I don't have to warn my players that Alt-Tabing is not allowed.

    3) How can I set a maximum speed to Spaceship Movement? It is not configurable to set a max, and if I add a line of "If Speed>10 then make Speed=10" then it seems to lose its newtonian flight. It just constantly thrusts at 10 even though you are not hitting the thrust key.


    Tom / Doc4

Similar Threads

  1. ForEach loop question
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 16th July 2014, 11:05 PM
  2. Loop Question...
    By Orpa1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 25th July 2009, 05:35 AM
  3. Loop question
    By maVado in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 21st May 2009, 02:21 AM
  4. MMF2 - Question on the MMF Loop
    By droberson in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 20th August 2008, 06:24 PM
  5. Fast loop question
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th April 2008, 12:33 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
  •