User Tag List

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

Thread: How do I switch two rows of an array?

  1. #1
    Clicker Fusion 2.5iOS Export Module
    lootercuster's Avatar
    Join Date
    Jan 2015
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post How do I switch two rows of an array?

    Hi, I have a number array with dimensions x and y. I use my x dimension to store whatever values i need. My y dimension are multiple save files all with different values in their x row. I want to be able to switch the position of my y's. For example, I have Y1 with a bunch of X values and Y2 with another bunch of X Values. Is there some way to be able to switch the values of the X's between the two Y's. I also want to be able to do other things like delete one row in the Y column and shift every row after it down one.


    Image attached below to try to explain my problem.
    Array Help.png

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    tompa's Avatar
    Join Date
    Nov 2011
    Location
    Uppsala, Sweden
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you have to write its functions manually. Are you experienced with arrays and fast-loops?

  3. #3
    Clicker Fusion 2.5iOS Export Module
    lootercuster's Avatar
    Join Date
    Jan 2015
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah can you help me out with that? I can't think of a universal loop that allows me to easily switch the positions of the Y rows. For now I only have functions that allows me to load, save, and select a certain row to view. Can you explain to me these function(s)?

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    tompa's Avatar
    Join Date
    Nov 2011
    Location
    Uppsala, Sweden
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I would structure like this:


    1) delete row and shift up subsequent values

    prerequisites: selectedX variable= a variable storing selected X index of the row to delete

    -on action "...."
    >> start loop "delete rows X" DimX - ( selectedX ) times

    -on loop "delete rows X"
    >> start loop "delete rows Y" DimY times

    -on loop "delete rows Y"
    >> array - set value at XY(selectedX+loopindex("delete rows X"),loopindex(delete rows Y))
    to get value at XY(selectedX+loopindex("delete rows X")+1,loopindex(delete rows Y))
    (don't know if in this way last row would be automatically deleted or if needs extra coding, this should be tested)

    2) switch two rows

    prerequisites: selectedX, selectedX1 variables= two variables storing the X indices to switch
    array: first row (x0) is used to temporary store the values to shift, so it shouldn't be used to save values!

    -on action "..."
    >> start loop "switch rows" DimY times
    >> start loop "switch rows1" DimY times
    >> start loop "switch rows2" DimY times

    -on loop "switch rows"
    >> array - set value at XY(0,loopindex(switch rows)) to get value at XY(selectedX,loopindex(switch rows))
    -on loop "switch rows1"
    >> array - set value at XY(selectedX,loopindex(switch rows)) to get value at XY(selectedX1,loopindex(switch rows))
    -on loop "switch rows2"
    >> array - set value at XY(selectedX1,loopindex(switch rows)) to get value at XY(0,loopindex(switch rows))

  6. #6
    Clicker Fusion 2.5iOS Export Module
    lootercuster's Avatar
    Join Date
    Jan 2015
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi i used your method of switching the rows. But I don't really know how the delete/ insert row loop works. I linked a mfa where I was able to get the rows to flip. If you have time, can you modify the mfa so that you can insert and or delete a row? If you don't have time, can you just explain it to me a little more so i can test it out? Thanks for your guys help!
    https://drive.google.com/file/d/0B_s...ew?usp=sharing

  7. #7
    Clicker Fusion 2.5iOS Export Module
    lootercuster's Avatar
    Join Date
    Jan 2015
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tompa View Post
    Can you explain to me the second part with the bank thing?

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    tompa's Avatar
    Join Date
    Nov 2011
    Location
    Uppsala, Sweden
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ops, it's my favorite (send to last)... it's not pushing. To push down I suggest starting from bottom, because then you don't need to buffer. Just write over.



  9. #9
    Clicker Fusion 2.5iOS Export Module
    lootercuster's Avatar
    Join Date
    Jan 2015
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see! I wonder if it is possible to create a universal loop combining swapping/inserting/removing. Because my goal is to be able re-arrange the Y rows by drag and dropping them into order. Ty for the visual explanation. I'm gonna try it out.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    This is what I was thinking of: ArrayManage.mfa

    All the list thing is obviously only to provide an interface and visualization

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 14th February 2014, 12:39 AM
  2. buttons and rows
    By JJ1234456 in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 11th January 2011, 03:20 AM
  3. How can I swap rows in a ListView object?
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 19th November 2010, 11:21 PM
  4. Creating objects in rows with variable dimensions
    By netninja in forum File Archive
    Replies: 0
    Last Post: 9th July 2009, 07:18 AM
  5. [BUG] ODBC - Condition Get Rows Count
    By byo in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 10th January 2008, 09:15 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
  •