Error when using for loop

Get help using Construct 2

Post » Tue Jan 29, 2013 10:37 pm

Hi everyone,

I have a simple piece of code which is used to generate 5 unique numbers. The range of these numbers should be between 1 and 12. The problem is that when I generate less than 7 numbers, it will display all 12 unique numbers from 1 to 12. If I generate more than 7 numbers, it works well without any issue. Also, I use the newest Construct 2 version on Windows 7 x64 Home Premium, graphic card is up to date.

Here is the link to my capx file. Please have a look.
http://dl.dropbox.com/u/44238179/Bugs.capx

Thanks in advance for your help.
Cheers, detno292013-01-29 22:38:49
B
10
S
4
G
2
Posts: 36
Reputation: 2,207

Post » Tue Jan 29, 2013 10:47 pm

Your for loop is running every tick, you should add a trigger condition to make sure it only runs once. ('On start of layout' or whenever you want it to happen)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Tue Jan 29, 2013 10:51 pm

Hi Nimtrix,

Thanks for your response. May I have another question: you mean the trigger once event right? In this situation, do I have to have any action inside this trigger?

Thanks very much.
B
10
S
4
G
2
Posts: 36
Reputation: 2,207

Post » Tue Jan 29, 2013 10:55 pm

Any condition with a green arrow over the icon is a trigger condition, as well as the 'Trigger once'. (A trigger condition only runs once)

If you want the loop to run right away use System -> On start of layoutNimtrix2013-01-29 22:57:18
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Tue Jan 29, 2013 11:16 pm

I got it. Thanks a lot for your help bro. I did not know that these loop will run on every tick.
B
10
S
4
G
2
Posts: 36
Reputation: 2,207


Return to How do I....?

Who is online

Users browsing this forum: Colorfish, Waltuo and 4 guests