UPDATE: Or block System picking objects bug found

Discussion and feedback on Construct 2

Post » Tue Jul 30, 2013 6:25 am

UPDATE: Check the second post for project file and image of issue, and the fourth post for a description of the issue/potential bug.

Hi, from my tests, I'm seeing that the OR block is picking objects even when one of the conditions in the OR fails.

For instance,

Tiger == Red
OR
Tiger == Green
OR
Tiger == Silver

If the tiger is Silver, it won't trigger because it is picking the red tigers in the first condition, and when there are no red tigers (only silver tigers), then the SOL is empty because of the failed first condition.

For reference, the actual condition I'm testing is the new System Pick overlapping condition, so maybe that's where the problem is.

I've isolated the OR block as to where the problem is lying. If I separate out each condition into separate events, it works. It only fails in this OR block.CannedEssence2013-07-31 00:53:49
B
11
S
2
Posts: 54
Reputation: 805

Post » Tue Jul 30, 2013 10:00 pm

Okay okay, I'll post a project file example and image:

CAPX: https://iu.box.com/s/erbqmp2jffivlzwrbu0y

Screenshot from project:


The event fails to trigger, even though the blue point is overlapping the sprite. If you disable the redpoint check condition, then it works.
If you insert a System Pick All Sprite condition in between the redpoint and bluepoint checks, then it works too.

Is this intended behavior? If so, I disagree that it should be that way. I don't think that conditions that fail in an OR block should be picking objects.
B
11
S
2
Posts: 54
Reputation: 805

Post » Wed Jul 31, 2013 12:07 am

That's a tough one.

I know this works;

Sprite | Overlap Red
-or-
Sprite | Overlap Blue

So I'm thinking it has to do with "System Picking" maybe? Does calling a System Pick break the rules?
B
12
S
5
G
2
Posts: 59
Reputation: 3,859

Post » Wed Jul 31, 2013 12:50 am

I think I figured it out.
It almost certainly is a bug.

The problem is that OR blocks with the System object picking another object are functionally the same as AND blocks.

If you do

System: Pick Sprite by evaluating 0 //this is automatically false
OR
System: Pick Sprite where Sprite.UID = 0

Then nothing is picked, even though there is a sprite with UID as 0. This shouldn't be the case.

If you do

System: 0 = 1
OR
System: Pick Sprite where Sprite.UID = 0

Then it successfully picks the sprite whose UID is 0. This is working as it should.

If you do

System: Pick all Sprite
OR
System: Pick Sprite where Sprite.UID = 0

it will select only the one sprite whose UID is 0. This is a design decision, but I consider it a poor one if it is intentional. It should pick all the instances of Sprite, because an OR block should stop evaluating the other conditions once it finds something that is true.

The argument would be that for example System 0 = 0 OR System pick Sprite.UID = 0 will keep the full Sprite instance list. Even so, that IMO should be how Construct operates. They can handle the picking in a sub-event if a non-picking OR condition is true.
B
11
S
2
Posts: 54
Reputation: 805

Post » Wed Jul 31, 2013 3:23 am

Yeah, I never really had a good grasp on this. As a result, I only ever use -or- when I'm not picking objects and implement -or- when picking by creating separate events. It would be nice to know what's happening under the hood here.
B
12
S
5
G
2
Posts: 59
Reputation: 3,859

Post » Wed Jul 31, 2013 8:55 am

@CannedEssence

If you think its a bug you should make a bug report.
B
48
S
16
G
9
Posts: 1,097
Reputation: 11,195


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 32 guests