User Tag List

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

Thread: Looping through an array file

  1. #1
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    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)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,132
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Looping through an array file

    hey everyone.. hopefully simple question.

    So I want to load the cells of an array (X dimension 24, Y dimension 11) into global values. Preferably in ONE event.
    so it would look like -
    set Global Value A to X0,Y0 (of array)
    set Global Value B to X1,Y0 (of array)
    set Global Value C to X2,Y0 (of array)
    etc.

    Now I can easily loop across the X dimension of the array using the loop index to determine which x cell to read/write from, so that the first 25 values are loaded..

    but how do I make the array jump to X0, Y1 and continue setting the global values in the same loop? atm I have to load each x dimension one after the other.. I'm sure there's a smarter way to do this? thanks!

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export Module
    Skyhunter's Avatar
    Join Date
    Jan 2007
    Location
    Croatia
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Divide the Y by X dimension.

    set Global Value to X(loopindex), Y(loopindex /25)

  3. #3
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    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)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,132
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    thanks for your reply.. but this doesn't work exactly how I want..

    This does add 1 to the Y index on the array but it doesn't set the X back to 0, so it goes X26, Y1 etc.

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export Module
    Skyhunter's Avatar
    Join Date
    Jan 2007
    Location
    Croatia
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yes i forgot, also for the X index do mod

    set Global Value to X(loopindex) mod 25 , Y(loopindex /25)

  5. #5
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    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)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,132
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I think I got it thanks!

    Does this look right to you? it seems to save/load all the values in the correct place..

    for some reason 0X,0Y is never written to.. but I don't think it matters. I think it may be because global values start at 1 not 0...
    Attached files Attached files

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export Module
    Skyhunter's Avatar
    Join Date
    Jan 2007
    Location
    Croatia
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, looks good.

  7. #7
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DaveC View Post
    I think I got it thanks!

    Does this look right to you? it seems to save/load all the values in the correct place..

    for some reason 0X,0Y is never written to.. but I don't think it matters. I think it may be because global values start at 1 not 0...
    You're going to need to do "loopindex+1" because fastloop indexes start at 0, but you are right that global values start at 1... So it definitely matters because you're saving data at 0,0 in the array but you're loading the global variables starting at index 1... meaning you are never loading that 0,0 position even though it's saved. Also the way you're setting the array value to load is odd (and won't work since you're setting the global value before you're defining the array position)

    You want to do something like:

    Set Global Value(LoopIndex("load")) to ValueAtXY( "Array", LoopIndex("load") mod 25, LoopIndex("load")/25)

  8. #8
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Also you're running your fastloops more than necessary... You just take your x dimension and multiply it by your y dimension... so 264 times instead of 300 that you're doing in your MFA. Right now it's fastlooping 36 more times (twice) for no reason.

  9. #9
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    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)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,132
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I'm a bit confused..

    from 0 to 24 is 25 across
    from 0 to 11 is 12 down

    so 25x12 = 300?

    when I look at the array data saved there is never anything save to 0,0 - but global value 1 is always loaded to 0,1....... eep.

  10. #10
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ah I was doing 24x11... Nevermind that then. :P

    When loading you should do "set global variable (loopindex+1) because the loop index is going to be 0... Since you can't set global variable 0 (it doesn't exist) you're losing that loop.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. OGG file smooth looping play
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 2nd February 2010, 07:20 PM
  2. OGG file looping
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 24th November 2009, 11:20 AM
  3. Looping an MMF array in Lua?
    By Nick in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 18th September 2009, 07:43 AM
  4. Looping through an array
    By Martin_Bodger in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th September 2008, 03:36 PM
  5. Looping an wav file without the glitch.
    By Dhondon in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 20th December 2007, 11:20 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
  •