User Tag List

Results 1 to 10 of 10

Thread: How to shuffle List Object lines

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to shuffle List Object lines

    I need to shuffle the lines of a List Object to have a random 12-slots-sequence of the numbers 1-8 plus 4 blank spaces.
    Is it possible?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just run a fastloop than randomly moves lines around for at least 12 iterations.

    EDIT: I didn't realize that the List Object didn't have some action to move a line.

    The way I like to shuffle a list is to use a second temporary list with all of the items, then randomly select from the list and move that random line to the end of the real list, deleting it from the temp list.
    But either way you would need to store the randomized number, and working in a single list would be good.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. It's quite tricky. I think that adding a shuffle option to the List Object in the future could be useful to simplify the process.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On that same thought, a Move Line action seems like a necessity, and I don't understand why it doesn't have it already. Just a simple Move Line A to B.
    If you need an example of the shuffling, I'd be glad to make you one.

  5. #5
    Clicker Multimedia Fusion 2 Developer
    gastrop0d's Avatar
    Join Date
    Dec 2011
    Location
    Australia
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To move a line you can insert a new line with the line-to-move's contents, then delete the original line.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but the problem occurs when you insert the new line before the original line. If it is inserted randomly you don't know which index to delete. You could get around this with FindString, I suppose.
    Regardless, this system, as I tried it, isn't that great, and the best random method is to use 2 lists.

    EDIT: Even better than using 2 lists is using the same logic all in one list. I'm attaching an example. Keep in mind what I said about using 2 lists to transfer the contents of one randomly to the other, and you should understand what I did.
    Attached files Attached files

  7. #7
    Clicker Multimedia Fusion 2 Developer
    gastrop0d's Avatar
    Join Date
    Dec 2011
    Location
    Australia
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good point.

    You could store the contents of the line, delete it and then insert the contents into the list at a random position.

  8. #8
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It's pretty simple.

    http://www.whenthereisnoroominhellth...huffleList.mfa

    One line of code.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ChrisBurrows, your example creates random empty lines... That's not good. It also depends on swapping lines a fixed amount of times (30 in your case). This means sometimes you get chunks of the list that stay the same and don't move.

    Look at my example; it's even simpler, less actions, and completely randomizes any list quickly.

  10. #10
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I only skimmed through the responses and didn't see you had beat me to it.

    My example doesn't create empty lines. There are 4 empty lines already in the list object because Boba Fonts was after a "12-slots-sequence of the numbers 1-8 plus 4 blank spaces". The loop runs for 30 times for no particular reason. It is just a lot higher than 12. Running it for the number of lines in the list (aka 12) creates the exact same effect.

    However, you do use less actions my friend, so I guess you win this round.

    Ps. you wish you were shuffling ever day.

Similar Threads

  1. How would YOU delete all blank lines from List Object?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 7th July 2013, 09:41 AM
  2. Moving lines in List Object
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 6th April 2012, 12:46 AM
  3. Giving lines in list object seperate values?
    By Yikes in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 25th June 2011, 10:02 PM
  4. List Object and empty lines
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th February 2011, 06:36 PM
  5. List Object - not remove empty lines?
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 3rd September 2008, 04:32 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
  •