The Phantom Menace(UID)

For questions about using Classic.

Post » Mon Oct 11, 2010 8:31 pm

I was looking over some recent threads about picking instances via UID, so I decided to see if there was some sort of pattern given to the uid when an object is created... and there is... sorta.
It seems the UID is assigned the current total object count when the object is created... ok fine, but for some reason there seems to be some extra object created, or at least counted at the same time.
Check the cap. On right click two objects are created on screen(sprite, and its container text), but the UID, and debugger says there's a third.
[url:3k34bqqw]http://dl.dropbox.com/u/666516/ghostinthecap.cap[/url:3k34bqqw]
So my question is what is this extra object?
The container?
The click?
Ok probably not the click.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon Oct 11, 2010 8:46 pm

The third object created is the Sprite's "drag and drop" behavior.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Mon Oct 11, 2010 9:12 pm

Wow. Really didn't see that one. I mean there's no reference to it in the debugger.
Alright so I guess I need to think of all plugins as objects, even if it is a behavior.
That kinda complicates things since each sprite, etc. could have multiple behaviors.
Rules out that idea.

So I guess all you can do here is use system TotalObjects as a way of getting UID.
But you would have to use the current count as the uid, before you create the object.. hehe
set globalvalue (TotalObjects)
>create object.sprite
>-set sprite value (globalvalue)

Thanks!
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests