Or bug

Bugs will be moved here once resolved.

Post » Mon Dec 15, 2014 12:33 am

Problem Description
____ When you have an 'Or' block with a condition <> "" and that object equals "", and there are other conditions that are true, the subevents don't fire ____

Attach a Capx
____
orBug.capx
____

Description of Capx
____
c2bug.jpg
____

Steps to Reproduce Bug
  • make 'Or' block with some true conditions, and one condition that is false ( <> "" )
  • add subevent that checks if object is invisible(true), with action to make visible.

    Observed Result
    ____ The subevent doesn't fire. ____

    Expected Result
    ____ The object should be made visible ____

    Affected Browsers
    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES/untested)

Operating System and Service Pack
____ Win Vista sp2 ____

Construct 2 Version ID
____ r190 ____
You do not have the required permissions to view the files attached to this post.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Mon Dec 15, 2014 12:40 am

Umm, the capx you provided is working fine, the sub-event is firing...what is the problem here? :?
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Dec 15, 2014 12:46 am

The sprite2 isn't made visible.
What version are you using TiAm?
I'm using r190.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Mon Dec 15, 2014 1:01 am

Okay, this is strange...I'm almost sure it was working before...but now it isn't. Hmmm...:?
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Dec 15, 2014 2:05 am

The second condition is asking C2 to PICK the Sprite2 objects where textVar <> "", of which there are none, so none are picked by the sub-event. You need to add "Pick all Sprite2" to event 3 to get the result you want.
ImageImageImage
B
71
S
22
G
248
Posts: 3,759
Reputation: 138,069

Post » Mon Dec 15, 2014 2:42 am

that's fine, but shouldn't this work?
orbug2.jpg

If you pick a sprite2, it should keep that picked.
So there's an issue going on here.
You do not have the required permissions to view the files attached to this post.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Mon Dec 15, 2014 2:53 am

another thing.. if it is an 'Or' block, if it finds one condition true, there is no need to check the following conditions- so why even try to pick sprite2 at all during the 'Or' block? This would be improper if it has to check all the conditions.

edit: to expand upon the previous post.. say I pick some sprite2 that match a certain conditions, and then do the 'Or', and there are some sprite2 that haven't been picked previously(and thus should be left out of the 'Or'), then it should only check the ones currently picked(it shouldn't have to check all the sprite2 during the 'Or').
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Tue Dec 16, 2014 5:30 am

I realized I could do the same thing a different way, so in-case anyone is wondering, here is the workaround to the problem:
orbug3.jpg


I don't really understand why the other way doesn't work, and I'm unsure if this workaround is viable in all situations, but for some it might be.
You do not have the required permissions to view the files attached to this post.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Tue Dec 16, 2014 6:24 am

Prominent wrote:that's fine, but shouldn't this work?
orbug2.jpg

If you pick a sprite2, it should keep that picked.
So there's an issue going on here.


Like @BlackHornet said, there are 0 Sprite2 instances picked after event 2, so filtering these further with the 'is visible' check does nothing (well not nothing, it causes you to have 0 picked instances). You need a pick all (presumably followed by a 'pick instance 0') before the Is visible check.

The reason your last example works is because you didn't change the picking after the initial pick instance 0, so it's still picked further down.

Regarding your question about evaluation of OR conditions, from the manual under 'or blocks':
Note that because OR blocks run if any condition is true, it's possible the event will still run if some conditions were false and did not pick any instances. In this case the actions will still run, but possibly with zero instances picked for any objects where no instances met the condition. If any actions are run for objects with no instances picked, nothing happens.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Dec 16, 2014 7:30 am

Alright.
Well, I still think it is illogical based on common sense- I can't see where the advantage is in that. I'd be interested in knowing why it is better that way compared to what I would expect it to do.

Why pick 0 of them if it didn't need to pick any in the first place? Seems like wasted processing.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests