How do I loop through specific array segments [SOLVED]

0 favourites
  • 5 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • Hello all,

    I am currently trying to loop through a specific array location (10, loopindex) to look for a value ("Com") at that location and generate a list of users who have that value (Each user has their own data stored in their own Y value of the array). This logic does not seem to be working...and this is actually kind off an important piece of my current project.

    My current approach is:

    -Repeat: Array.height times

    Array: compare value at (10,loopindex) = "Com" --> System: Create Button Object at X/Y

    How else might I approach this to get the result I'm looking for?

    Thanks for any help!

    EDIT:

    I discovered that using the Array object to check for the value does not work as expected, but using the System to compare values in the array does. I'll leave this up for anyone who may benefit. If anyone knows why that might happen from a logic perspective I'd also love to know!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Works both ways...

  • oosyrag

    Hmmm not for me. I notice your arrays are only one dimensional. I'm doing a 2 dimensional array so perhaps that's where the difference is coming in? I've tried this in a test capx and it never works unless I use the system to compare the values. After trying in multiple projects since this post I've even found that the outcome is inconsistent on desktop (If it's a sprite that is shifted it works, if a button, maybe not) but completely consistent on an iPad. So I'm kind of baffled. If you continue to find that both logics work in a 2 dimensional array, I'll have to uninstall and reinstall everything I suppose? Not sure what else I could do.

  • Not sure... inconsistent results in various situations would be hard to pin down.

    The main thing that comes to mind is that the array compare current value condition only works within an array for each element event, but yours doesn't seem to be the case.

    Anyways I'm glad you got something working! I can pretty confidently say uninstalling and reinstalling would not change anything. If you want to post your test capx maybe I can poke at it a bit, I'm pretty curious now

  • Not sure... inconsistent results in various situations would be hard to pin down.

    The main thing that comes to mind is that the array compare current value condition only works within an array for each element event, but yours doesn't seem to be the case.

    Anyways I'm glad you got something working! I can pretty confidently say uninstalling and reinstalling would not change anything. If you want to post your test capx maybe I can poke at it a bit, I'm pretty curious now <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    Hey! Just tested the file again and now it's working both ways? I'm not sure why I was running into trouble now..especially so consistently.. But on the bright side, hopefully this means my other project will act reliably as well. Might as well share the file anyways lol.

    https://www.dropbox.com/s/kbz9yoemz8o3i ... .capx?dl=0

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)