pick object by uid (SOLVED!!! er...REQUEST FILLED!)

New releases and general discussions.

Post » Fri May 01, 2009 9:53 pm

I think it's been mentioned by others as well as myself,
but then I learned alot and thought it was no longer necessary
and then I learned alot more and I realize
it really would be ridiculously useful
and allow alot of flexibility with functions and complex object interactions

sometimes you need to be able to choose an object out of a pool of many
without being able to pick it first
or you want to be able to remember a list of certain objects for later picking
without being able to repick some object that you're going to pair them to

I don't mean anything complex, just an event
pick object by UID
then you put the UID
and it will pick whatever object and only that object will be picked(unless there are other conditions in the event)

I understand it's possible to do a for every object and then a UID is equal to temp
but first, this would require a different event for every object type or family
and if you want to use this feature alot, it will always be looping through every object over and over

if it's possible with python, someone please explain where I can start looking and whether this feature is broken, or more generally, exactly how broken python is

I can't remember what the reason this UID picking idea is usually rejected for, or if it's just usually a request not responded to. is it harder than it seems?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri May 01, 2009 10:08 pm

[quote="lucid":19esn4co]sometimes you need to be able to choose an object out of a pool of many
without being able to pick it first[/quote:19esn4co]

I don't know what you mean by this. Is there any significant difference between "choose" and "pick" in this context?


Also, you don't need a For Each Object loop to pick by UID, you just compare the UID. For Sprite, there is a specific condition just for that under Misc. For other objects you can do a Pick By Comparison and use obj.UID as an expression.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri May 01, 2009 10:47 pm

thanks deadeye.
[quote="deadeye":25orbjsp][quote="lucid":25orbjsp]sometimes you need to be able to choose an object out of a pool of many
without being able to pick it first[/quote:25orbjsp]

I don't know what you mean by this. Is there any significant difference between "choose" and "pick" in this context?[/quote:25orbjsp]
I meant just pick it without it having to trigger an event

[quote:25orbjsp]Also, you don't need a For Each Object loop to pick by UID, you just compare the UID. For Sprite, there is a specific condition just for that under Misc. For other objects you can do a Pick By Comparison and use obj.UID as an expression.[/quote:25orbjsp]

cool, I just realized the compare UID thing for sprites, before I came back to the forums. as for the other objects and pick by comparison, I guess something someone said at one point made me feel this would be inefficient in large doses, like it's cycling through each object, and if you had a few hundred things to pick from and you were picking more than one UID every tick, it would eventually start slowing things down. is this true? or is it cycling through every object to check a variable a negligible amount of cpu time that won't really add up? because if that's the case, it will simplify alot of other things on this project.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri May 01, 2009 11:27 pm

btw, in case anyone was wondering
it isn't a significant amount of time to check lots of UIDs
I just made construct check the unique ids of 100 sprites 500 times a tick
which is a total of 50,000 UID checks per tick
and it was still running at 400fps

thanks again deadeye
this made my day
man oh man, wait till you guys get a load of what I'm working on :mrgreen:
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest