Pick objects with two 'or' conditions

Get help using Construct 2

Post » Sat Jul 27, 2013 3:15 am

I'm not sure what's wrong with my code here... I'm sure I've just done something silly.

I would expect this code to only select things that are a = 0 AND b = 0 or 1 AND c = 0 or 1 but it's picking everything where a = 0.

Any help would be much appreciated! The code works with only one indented line (e.g., a = 0 AND b = 0 or 1) but doesn't work with both indented lines.



Capx here: http://db.tt/xJln01ew
B
9
S
3
Posts: 58
Reputation: 1,566

Post » Sat Jul 27, 2013 3:36 am

Add a For Each at the top, and drag a=0 (etc) to be it's sub-event. Then it works.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sat Jul 27, 2013 3:58 am

Hm okay, thanks! However, what if I want to just pick *one* instance of a text object that corresponds to a = 0, b = 0 or 1, and c = 0 or 1? I was hoping to narrow the picked list down and then top it off with a 'pick random instance' but it doesn't work with a 'for each' obviously.
B
9
S
3
Posts: 58
Reputation: 1,566

Post » Sat Jul 27, 2013 4:32 am

PickingProblemWithOrs_BHT_v2.capx

(I changed "4" for more variety.)blackhornet2013-07-27 04:33:53
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sat Jul 27, 2013 7:26 am

Thanks so much! This works perfectly. Interesting that the original way didn't work but glad there was another way to do it. :D
B
9
S
3
Posts: 58
Reputation: 1,566

Post » Sat Jul 27, 2013 2:25 pm

I'd say you can report this as a bug. Here's both mechanisms. They should be equivalent.
PickingProblemWithOrs_BUG.capx
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494


Return to How do I....?

Who is online

Users browsing this forum: Armench, brunopalermo, MeteoorSC, TRMG and 25 guests