How Construct picks objects in different blocs?

Discussion and feedback on Construct 2

Post » Sat Jan 16, 2016 8:13 pm

Hi,

What is the expected behavior for Construct to pick objects when the object was created in a separated block?

I created this little test. It creates an object and then try to pick it in different ways.

Image
(see the full image: https://dl.dropboxusercontent.com/u/313 ... et%201.png)

What I'm wondering is why the "Pick all xxxx" doesn't catch the newly created object.

Here's the link to my capx: https://dl.dropboxusercontent.com/u/313 ... reate.capx
B
19
S
5
Posts: 80
Reputation: 1,383

Post » Sat Jan 16, 2016 8:19 pm

This has been documented many times. You can't pick a newly created object until the next top-level event.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sat Jan 16, 2016 8:47 pm

They are already picked.
Image ImageImage
B
169
S
50
G
174
Posts: 8,327
Reputation: 110,798

Post » Sun Jan 17, 2016 2:01 am

Hmmm I see... But then, why is it picked in my event #6 (pick instance with UID)? It's not in the next top level event, so it should not pick the newly created object, right?

And then, if I really want to pick it in another block when the button is clicked, I should create another top level "on button clicked" event? That's the recommended way of working around that limitation?

Is there documentation I could read on the subject? I tried looking in the manuals but I can't find anything about those technical aspects.
B
19
S
5
Posts: 80
Reputation: 1,383

Post » Sun Jan 17, 2016 2:36 am

Pick by uid is the exception. It can pick any new object at any time. You can find some more details about top level events by searching for top level in posts I've made.
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Sun Jan 17, 2016 6:49 pm

Ok, I see now.

For reference, if someone else find this post, here's links to other topics where this is discussed:
is-this-a-bug-can-t-pick-objects-created-in-the-same-ti_p890954?#p890954
and
will-the-span-class-posthilit-top-span-span-class-posthilit-level-s_p980737?#p980737

Is there any official documentation about this? I can't find anything in the manual. Might be useful to also add a warning next to the "create object" function on this page: https://www.scirra.com/manual/125/system-actions
B
19
S
5
Posts: 80
Reputation: 1,383

Post » Mon Jan 18, 2016 1:36 pm

What exactly is considered a top level event?

I'm guessing from the name it's an event that is not a sub-event.

1) If my event is inside a group, or inside a group-in-a-group, it is still a top level event? (I saw some confusion in other posts)

2) Are functions top-level event? I'm guessing that it depend on where I call that function?

3) Events that are triggered at the end of something, like "on path found" or "on preload complete", etc. Are those top level?
B
19
S
5
Posts: 80
Reputation: 1,383

Post » Mon Jan 18, 2016 4:02 pm

In your example above, coming out of event #1, would be considered reaching the next top-level event. Anything you do, still inside event #1, including groups, functions, is still not valid. Triggers should be OK, as they are outside of the event loop, but if the trigger happens immediately, I'm not 100% sure then.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Mon Jan 18, 2016 7:14 pm

1.
Yes that should still be a top-level event. They didn't use to be but it was changed, so maybe that's the confusion.

2.
It depends on where the function was called from.

3.
It depends when the event was triggered.
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 22 guests