User Tag List

Results 1 to 7 of 7

Thread: Populating duplicate active objects from an array

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Populating duplicate active objects from an array

    Hi All,

    I think I may have just been staring at this problem too long and I can't tell why it isn't working. So I thought I would ask if anyone has a simple solution. I have a shop with 7 slots, each slot is a duplicate of a "slot" active object that has an AltVar "SlotIndex" to be able to identify them individually. Slot 0 and 6 (the first and last slots) are reserved as buttons. Slot 5 is an "exit" button. So I populate slots 1 through 4 with data (cost, etc) in each slot's AltVars from an array.

    mockup.png

    The tricky thing I have run into is how to have more than one "page" of items that you can cycle through and repopulate the slots with. The array has 15 unique X Dim entries, with Y Dim used for the cost, etc. Since each page of the shop shows 4 items at a time, I need to read only 4 entries from the array at a time. I can get the first page to show up properly (the array populates the AltVars of each "slot" active obj correctly) but once I start reading the array for the other pages, the slots stop behaving properly.

    I'm pretty sure this is an object selection issue (since slot0 is actually ignored), but I have seen some array coding in MMF that confuses me because I have no idea how objects are selected differently when dealing with arrays.

    Can anyone provide an example of how I would read the array for each page and repopulate the slots?

    Cheers,

    Reg

  2. #2
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA 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)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    284
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi Mobichan, I'm pretty sure I can help you with this if you haven't found a solution yet but I'm kind of confused about what you're trying to achieve. I don't know what kind of GUI you're using and how you want the information displayed. I'll make a quick mfa later when I have more time that will hopefully help though.

  3. #3
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I don't know if I understand you correctly but are you setting each slot's 'SlotIndex' to the next/previous 4 when a page is 'turned'? If that's the case are you then doing valueatxy = slotindex then altvar 'slotindex' = value in array? also setting the animation frame/direction to the number of each slot? In theory this should work but an example mfa would definitely help.

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    So, the GUI looks like the image I attached to my original post. The idea is to show the items in pages of 4 at a time. When you cycle to the next page, the "slots" (which are active objects with different images in the animation frames for each shop item) a value is set in the active object that is used to set the animation frame of that active object. So, I was trying to populate each slot with array entries 0 - 3 for page 01, array entries 4 - 7 for page 02, etc. I can get page one to work, but I seem to be unable to get page 2+ working. I was running a fastloop to repopulate the slotindex var, but for some reason, the code that works fine on page 01 doesn't work on the other pages. I think it is probably something simple, but I have stared at this so long that it isn't making sense why it doesn't work.

    Any example would be very helpful, since dealing with arrays always trips me up.

  5. #5
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I hope this is what you mean!

    slotvalues.mfa

    To explain:

    The "Always" condition 'populates' each duplicate slot in reference to it's index value and the Y value of the array, for which I've used a reference active with values numbered 0, 1,X for each item. However, this is just for ease of inputting stuff because I find using a reference active makes things easier when working with arrays, that way you can remember what Y value holds which item. You could just as easily use numbers, eg:

    +always:
    --> set 'weapon' to StrAtXY(array): Slotindex(slots), 1

    instead of

    --> set 'weapon' to StrAtXY(array): Slotindex(slots), Weapon(Vals)

    come to think of it, you don't even need to set each slot's values as you could read these directly from the array so instead of 'populating' the slots you could just do whatever else you wanted to do with the fetched strings.

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    SolarB: This is dead on to what I am attempting. Since this is for iOS and PC, I needed to modify the Always condition to only load when the arrow is pressed, so the slots are refreshed only once. I was running a loop before to refresh the slot index, but I really was overcomplicating it. ^_^' This stuff always looks so obvious when other people do it. Thanks so much for the help.

    Cheers,

    Reg

  7. #7
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    No probs, and if you REALLY want to save yourself some extra nanoseconds of calculation you could read directly from the array instead of populating the slots, ie:

    + on right/left arrow
    + slot selected = slotindex(slots)
    --> change (moneystring) to valueatXY(array): Slotindex(slots), Cost(vals)

    and even:

    + user clicks/presses enter:
    --> subtract [valueatXY(array): Slotindex(slots), Cost(vals)] from [money]

    that way your slot actives wouldn't need any vars except for their index.

Similar Threads

  1. Set position of 1 duplicate of an active, without it applying to all duplicates.
    By Oreo in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd March 2013, 02:30 PM
  2. Duplicate objects/enemies and have them each behave on their own? I know theres a way
    By edman3d in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 23rd December 2012, 09:58 AM
  3. how do i make all duplicate objects face...
    By solarstorm in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 21st May 2011, 08:40 PM
  4. [BUG] can't duplicate active system backgrounds
    By therickman in forum File Archive
    Replies: 0
    Last Post: 30th September 2010, 02:36 PM
  5. Order of duplicate objects.
    By Livingstone in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th May 2010, 04:20 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
  •