Instance Var Condition only filter 1 instance ?

Discussion and feedback on Construct 2

Post » Thu Mar 22, 2012 6:55 pm

I just notice today that, these condition:
- Compare instance variable &
- Is boolean instance variable set


only pick 1 instance instead of filtering all the instance that match the condition,
so i have to actually use "For Each" to filter all instance that match the condition.

Example capx:
http://dl.dropbox.com/u/39382262/ConditionFilter.capx

my question is:
- Is this by design ?
- Is there any condition that behave like this too that i should be aware of ?

I'm confused because according to the manual:

http://www.scirra.com/manual/75/how-events-work

When certain criteria are met in the condition, it will filter the instances meeting the condition.
turns out it's not always work that way, like in the above case (only picking 1),
this could create some confusion for those newcomer like me :P
B
34
S
13
G
8
Posts: 134
Reputation: 8,118

Post » Thu Mar 22, 2012 7:34 pm

It's working correctly.

The "Text" instances are being filtered but the "CheckBoolean|Append Text" action is only run once for each "CheckBoolean", so only one "Text" instance is used in the event.
B
79
S
24
G
53
Posts: 4,735
Reputation: 40,233

Post » Thu Mar 22, 2012 7:45 pm

Ah i got it, thanks R0J0hound

I thought all the action will automatically run, as many times as the number of filtered instance

Thanks again
B
34
S
13
G
8
Posts: 134
Reputation: 8,118

Post » Thu Mar 22, 2012 8:32 pm

This is where you would want to use for each.
More specifically, people use for each way too often. This is the perfect place for it.newt2012-03-22 20:35:50
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749


Return to Construct 2 General

Who is online

Users browsing this forum: TRMG and 15 guests