For Each....

Get help using Construct 2

Post » Thu Jan 05, 2012 7:24 pm

Is this a bug in R74 or am I just to dumb to understand the concept of "For Each"?!



I have 17 instances of "InventorySlot" - but this loop keeps counting till hell freezes over?!

Where do I fail?!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Thu Jan 05, 2012 8:09 pm

This event probably runs every tick, meaning that every tick it will add (the) 17 instances to count.
You probably need to add more conditions to limit its execution, or pay more attention to where it is placed (for example, as subevent of a start of layout event, it will only run once on the very beginning of the layout.)

Be sure to read over and over again how events work.
When in doubt, look at your code and try to "translate" it the way C2 will read it.

Event 4, every tick it will loop through each instances of InventorySlot and add 1 to the variable count.Kyatric2012-01-05 20:10:38
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Jan 05, 2012 8:20 pm

Thanks!!!

Even thou I placed it "stand alone" you were right with the "every tick" assumption.

I now placed as sub-event under "Layout start" and it worked!

Cheers
Matt
B
42
S
19
G
12
Posts: 723
Reputation: 13,911


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, Yahoo [Bot] and 27 guests