How do I loop through specific array segments [SOLVED]

Get help using Construct 2

Post » Sat Mar 17, 2018 8:21 am

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!
B
80
S
48
G
30
Posts: 420
Reputation: 22,515

Post » Mon Mar 19, 2018 10:21 pm

Works both ways...

Image
Mistakes were made.
B
60
S
30
G
132
Posts: 1,932
Reputation: 74,341

Post » Tue Mar 20, 2018 1:18 am

@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.
B
80
S
48
G
30
Posts: 420
Reputation: 22,515

Post » Tue Mar 20, 2018 3:11 am

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 ;)
Mistakes were made.
B
60
S
30
G
132
Posts: 1,932
Reputation: 74,341

Post » Tue Mar 20, 2018 4:16 am

oosyrag wrote: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 ;)



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
B
80
S
48
G
30
Posts: 420
Reputation: 22,515


Return to How do I....?

Who is online

Users browsing this forum: draiza and 5 guests