User Tag List

Results 1 to 5 of 5

Thread: Array Question

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProPatch Maker
    coreyschroeder's Avatar
    Join Date
    Apr 2014
    Location
    ATX
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Array Question

    I'm trying to figure out how to add a value to an array in the next available slot (without having to specify the slot number).

    I've found where you can add to the current position, or to a specific slot, but I can seem to find the "add to next available slot" button

    The closest work around I have found is to add the value to "the current position + 1".. This works perfectly, however it leaves the fist slot of the array blank (as its being skipped from the +1)...

    Help a noob?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    UltimateWalrus's Avatar
    Join Date
    Jul 2006
    Posts
    824
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not a hundred percent sure what you mean by "available slot." All array indexes are available at any time.

    Are you saying you want to find the first array index that is equal to 0? In this case you'll need to use a fastloop:

    This is pseudocode so there may be typos:

    Code:
    Always
       --> Start loop "FindZero" XDimension("Array") times
    
    On loop "FindZero"
    + ValueAtX("Array", loopindex("FindZero") ) is equal to 0
        --> Array: Set value at X loopindex("FindZero") to [whatever you want]
        --> Stop loop "FindZero"
    Edit: forgot to mention this assumes you are using zero-based indexing with your array, which makes the most sense for almost all programming anyway.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProPatch Maker
    coreyschroeder's Avatar
    Join Date
    Apr 2014
    Location
    ATX
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I apologize for not being more clear in my goal -

    Lets say we have an edit box that a user can input a string - upon pressing the "enter" key, I would like that string to be appended to the array in the first empty index.
    I'm new to Fusion, so please excuse the noob question here..

    I read online that its best to start your arrays with only one index for each dimension, and add as you need them (as you cant make the array smaller, you can only make it larger).. Is this true?

    With that said, I've created a 1x1x1 array that I would like to append all of my strings to.
    I've tried your code (of course, altered for strings and not values, etc).. It doesn't seem to resolve the issue.

    I'm just trying to build onto the array..
    If there is nothing in index zero, add it.. If there is something in index zero, create a new index and add it there.

    I hope this makes better sense.


    PS - I went to your website and downloaded several of your games. Trike and Chroma Cave are awesome man! Congrats!

  4. #4
    Clicker

    Join Date
    Jul 2011
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mfa.aquadasoft.com/upload/1397400403-EX.mfa

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProPatch Maker
    coreyschroeder's Avatar
    Join Date
    Apr 2014
    Location
    ATX
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    klikhappy - this was incredibly helpful - basing the index off of the global value worked out perfectly!!! I cannot thank you enough!

Similar Threads

  1. noob Array question
    By Om1nO in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 30th November 2010, 06:57 PM
  2. Array naming question
    By SharpS in forum Multimedia Fusion 2 - Technical Support
    Replies: 14
    Last Post: 29th September 2010, 07:37 AM
  3. Very simple question about the array obj! :)
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 14th December 2006, 12:57 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
  •