User Tag List

Results 1 to 3 of 3

Thread: Removing an index from an array

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

    Join Date
    Jul 2006
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Removing an index from an array

    Is there a way to remove an index from an array.

    For example:

    An array with only strings entered into the x dimension (y and z index are not used).
    x1 = "one"
    x2 = "two"
    x3 = "three"
    x4 = "four"
    x5 = "five"

    If I went through the above index printing out all the values in a text box one line at a time I would get the following:

    one
    two
    three
    four
    five

    I want to be able to remove x index 3 (the one that has the "three" string in it) so the output would then be:

    one
    two
    four
    five

    How would I do this? I see how to write new values and strings in the index and increase it's dimension (size) but how do I remove a value from the index and reduce it's dimension (size)?

    Jason

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2006
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Removing an index from an array

    Anyone?

    Jason

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Removing an index from an array

    What I do to format the array object is to iterate through the array and copy/paste everything into a new array, save that array to a temp file, and load that temp file into the original array. I do that since a lot of data in my level editor gets replaced by "0"'s, and being an associated array I can compress the file size that way.

    Just do something like this:


    *On Whatever Action
    =Start Fast Loop "ReduceArray" for #(XIndexSize("Array")) loops

    *On Fast Loop "ReduceArray"
    =Write String (GetStringAtX("Array", LoopIndex("ReduceArray"))) to X = (LoopIndex("ReduceArray")) to object "TempArray"

    *On Whatever Action
    =Save array "TempArray" to file (Apppath$+"TempArray.arr")
    =Load array "Array" from file (Apppath$+"TempArray.arr")
    =Delete File (Apppath$+"TempArray.arr") by using the File Object (its included in your MMF2 objects)

Similar Threads

  1. Dynamic Array - Sort 2 dimension array by Column 1
    By Ryan in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 16th December 2012, 04:54 AM
  2. Dynamic Array index base?
    By gastrop0d in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 20th December 2011, 07:49 AM
  3. ignoring array index values before the current one
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 24th February 2009, 09:02 PM
  4. fast loop & array index
    By delusan in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 19th October 2007, 05:37 PM
  5. Dynamic Array- find row index?
    By crugh in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 11th May 2007, 04:21 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
  •