0 Favourites

How do I loop through specific array segments [SOLVED]

  • 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!

  • 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

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,136
karshinkoff's avatar
karshinkoff
Unread hot topic
56 4,728
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
0 Favourites
Why is Stencyl doing better?
44 16,852
Potato's avatar
Potato