Looping Array Index

For questions about using Classic.

Post » Mon Apr 13, 2009 5:01 pm

Hi, I am looping through an array, and checking each position in the array to see if it equal to 1. If it isn't, I set it equal to one. If it is, I move on to the next position and check again. If I'm looking at an index that is higher than the length of my array, I start over from index 1.

The problem is, after I loop back to the first index of the array, I can never increment the index again.

Here is a cap to demonstrate the problem

Am I doing something stupid with the loop? Thanks for any assistance!
B
4
G
3
Posts: 21
Reputation: 942

Post » Tue Apr 14, 2009 12:04 pm

the 'compare value at x' condition of the array does not evaluate correctly if x is 1; that's a bug. i've added it to the tracker.

you could work around this by using the 'compare' condition of the system object.
B
2
S
2
G
4
Posts: 171
Reputation: 1,792

Post » Tue Apr 14, 2009 12:37 pm

[quote="dkdoom":1im2xan0]the 'compare value at x' condition of the array does not evaluate correctly if x is 1; that's a bug. i've added it to the tracker.

you could work around this by using the 'compare' condition of the system object.[/quote:1im2xan0]

Thank you, that works perfectly!

I'm glad to see it wasn't just me being stupid.
B
4
G
3
Posts: 21
Reputation: 942

Post » Tue Apr 14, 2009 1:18 pm

It's fixed in the next build, but there's an infinite loop in your .cap when they're all set to 1 :).
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Tue Apr 14, 2009 1:31 pm

[quote="Rich":1gohl3f4]It's fixed in the next build, but there's an infinite loop in your .cap when they're all set to 1 :).[/quote:1gohl3f4]

Yes, thank you. This was just a sample cap to demonstrate the problem I was having.

Great news on the bug fix!
B
4
G
3
Posts: 21
Reputation: 942


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests