Referencing newly created object

For questions about using Classic.

Post » Tue Oct 05, 2010 7:50 am

So I'm using Create OBject By name to create an object in the Items family. However, doing a For Each Items, Set XY does not affect these newly created objects. Any ideas on how to get around that?
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Oct 05, 2010 8:12 am

[quote="Juryiel":18wusl4l]So I'm using Create OBject By name to create an object in the Items family. However, doing a For Each Items, Set XY does not affect these newly created objects. Any ideas on how to get around that?[/quote:18wusl4l]

Well, unfortunately you cannot simply do that (anymore, since it used to work but was removed due to being part of an actual bug). So no, you can't pick an object created by name in the very same tick with events afaik.

You can still pick the newly created object by family if you call a function with a minimal delay that manipulates it. It may be necessary to use a PV too, to avoid picking already manipulated members of that family.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Oct 05, 2010 4:11 pm

Thanks. I'm at work now so i can't check, is there a simple Delay X ticks action I can just put in after the Create Objects by name action that would take care of it?
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Oct 05, 2010 8:45 pm

[quote="Juryiel":2s23k2ai]Thanks. I'm at work now so i can't check, is there a simple Delay X ticks action I can just put in after the Create Objects by name action that would take care of it?[/quote:2s23k2ai]

The function object has an action to call a function after a delay. Read more about it on the wiki.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Wed Oct 06, 2010 2:39 am

That does work, thanks. I was wondering though, is it on the next tick that I can move the items? If so, is there a way to delay a function by tick amount? I can only find milliseconds, and I know it's unlikely but in the rare case of a hickup (perhaps a user would be runnign multiple apps in teh background) that might cause it to not work since the current tick might last a longer time than the millisecond delay I have.
B
11
S
2
G
3
Posts: 283
Reputation: 1,968


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests