Pick All / Create Bug

Bugs will be moved here once resolved.

Post » Fri Jun 24, 2016 8:22 pm

Problem Description
Created objects aren't picked.

Attach a Capx
https://1drv.ms/u/s!AhHSZHEulqh_gTlThpxipQKQXDNY

Description of Capx
Created objects, and tries to pick them all, then rotate them all

Steps to Reproduce Bug
  • run and see which objects are rotated

Observed Result
Only one Sprite is rotated.

Expected Result
All Sprites should be rotated.

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

Operating System and Service Pack
vista sp2

Construct 2 Version ID
r227
B
48
S
22
G
65
Posts: 1,130
Reputation: 38,426

Post » Sat Jun 25, 2016 1:42 am

It is not a bug. New created instances will not be put into SOL until next tick.
Add system: wait 0 after system: create , then you can pick all instances.
B
109
S
27
G
278
Posts: 4,483
Reputation: 155,426

Post » Sat Jun 25, 2016 2:52 am

They'll be put in the SOL before the next tick. It can be picked in the next top level event.
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Sat Jun 25, 2016 2:55 am

When you create an object, that object immediately gets picked. If it can be picked immediately after creation, why can't it be picked at any other time?
B
48
S
22
G
65
Posts: 1,130
Reputation: 38,426

Post » Sat Jun 25, 2016 11:19 am

There are three lists internally:
Instance list
New list
Sol list

By default the sol list will be the instance list, which you then filter. When you create an object it's added to the new list and the sol is set to it. The pick all sets the sol to the instance list and since the new list isn't added yet those objects aren't picked. Then at the next "top level" event the new list is merged into the instance list.

You can search the forum for "top level" for some more discussions/explanations of this. In one of the change logs had a fix where before "pick all" would pick the new ones too. This was fixed to prevent cases of infinite loops.

Alternatively the pick by uid can pick objects from the new list. It's the exception to the rule.
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Sat Jun 25, 2016 5:22 pm

That's weird. Why change that to prevent infinite loops? Users can still create infinite loops. If it was possible for pick all to include new objects, that makes more sense to keep it that way than to have it not pick them.
I want to know the reason against it.
B
48
S
22
G
65
Posts: 1,130
Reputation: 38,426

Post » Sat Jun 25, 2016 6:20 pm

The version this was changed:
https://www.scirra.com/construct2/releases/r102

A discussion about it with input from ashley:
r102-breaking-change-questions_t73647
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Sat Jun 25, 2016 7:19 pm

That doesn't explain why you can't use Pick All as another sub-event inside the created objects event to include the new objects.
If the issue was new objects being included in events outside the sub-event (the sibling sub-events), then shouldn't it be alright to include the new objects in the nested sub-events ?
B
48
S
22
G
65
Posts: 1,130
Reputation: 38,426

Post » Sun Jun 26, 2016 12:47 pm

I had a similar problem calling a function which sorts zOrder after an object was created. The function would sort everything except the created sprite, even though the function picked all. Function is top level event, bug or by design?

On colission
-> Create Sprite
-> call function

function picks all. sorts z-order.
did not work. the newly created object is not sorted with the rest.

On created (new top level event)
-> call function

function picks all. sorts z-order.
did not work. the newly created object is not sorted with the rest.

I can't get the created sprite to sort with the rest of the objects, even after calling a function.
wait 0 works but creates ugly unsorted graphics glitch for a fraction of a secondbefore it's sorted correctly.
Follow my progress on Twitter
or in this thread Archer Devlog
B
41
S
18
G
19
Posts: 1,048
Reputation: 13,988

Post » Sun Jun 26, 2016 6:02 pm

Yes, I noticed that too in my attempt to find a solution to the problem. Functions don't seem to act like top-level events, so they can't select the newly creates objects.
In many cases, using a Wait is not an option, as it disrupts the flow of the program, causing things to become unsynchronized. You then have to create more variables/etc and methods to check when to do things.
If you could pick the newly created objects (perhaps only in the nested sub-events?), it would solve these problems and help make the events simpler/cleaner.
B
48
S
22
G
65
Posts: 1,130
Reputation: 38,426

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest