Severely depressed from UID pick failure

Get help using Construct 2

Post » Wed Jan 25, 2012 5:14 pm

Damn I've been so ninja'd!

Well, @Ashley, why is it such a bad idea to create instances of array?
I was planning on doing that do stream the creation of next levels of a maze while playing the current one. So running the same algorithm on the same array but with an instance variable to differenciate them.
Like if Array.level = nexLevel -> run the algo on it
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Jan 25, 2012 5:15 pm

@Ashley: Regarding Option (3), that's what I had initially; separate array objects, the problem with this is that I have a rexrainbow function which takes an array as a method parameter. Normally, I would consider putting all of my arrays into a single Family, but I assumed that cast to Family like ArrayFamily(Function.Param(0)) where Param(0) is a UID of an Array belonging to ArrayFamily would fail or would have some unexpected results since Family is still fairly new and Family behaviors are not yet implemented.
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Wed Jan 25, 2012 5:38 pm

Well the main issue with different instances of an array is it can be confusing. For example, the way event picking works is if you pick more than one array instance it will be writing to two arrays at the same time. And this all happens "invisibly" - it's hard to check which arrays are being written to and what their content is.

It's clearer to think about if you only have one instance of an array. If you need multiple 2D arrays, use one 3D array instead, or different array objects if possible. On the other hand, if you know what you're getting in to, I guess you can go ahead and use multiple array instances!
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Jan 25, 2012 5:53 pm

Cool :D That should simplify things!
But I understand the fragility of such method. I'll be keeping an eye on debug values.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Jan 25, 2012 6:03 pm

Its not that fragile. Pick nth, or the index should work for all objects.
array(1).at(x)
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Jan 25, 2012 6:49 pm

@Ashley, I've discovered another bit of strange behavior with the pick although I'm not willing to discount the possibility that maybe I'm just misunderstanding how the pick is working in this case.



Since I've reset my pick list, how come referencing a specific BaseArray via a (UID) index doesn't seem to be working properly?

I created this capx from scratch to test it.
Forloop Pick Project


B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Wed Jan 25, 2012 6:55 pm

The indexing in actions ( array(index) ) works with a specific indexing of the currently picked instances (possibly IID, to be confirmed by @Ashley), not their UID.
If you want to pick a specific array out of its UID, add conditions after "Pick all BaseArray" Array.Pick by UID = your global variable.Kyatric2012-01-25 18:56:26
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Jan 25, 2012 6:58 pm

@Kyatric. Thanks that clears it up, I didn't realize that the ( ) index was a reference to a IID. I'm going to have to re-read the manual about picking/indexing/IID/UID so that I avoid making this kind of mistake again.
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Wed Jan 25, 2012 7:00 pm

Picking is picky ^^
But that's what makes the beauty and power of C2 in the end.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Jan 25, 2012 7:01 pm

Well you already know that the first array is (0), so the one you create is (1).
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: bluemonkey, Khamsou and 24 guests