How do I store NAME of objects to an array

Get help using Construct 2

Post » Mon Nov 03, 2014 11:26 pm

How do I: Store the NAME of objects onscreen to an array?

I have 3 objects on screen (for now). They're all in the same family.
How do I code a system that goes through the objects 1 by 1 and saves their NAME(s) to a 3 by 3 array, at position X=0 for each?
B
7
Posts: 33
Reputation: 341

Post » Tue Nov 04, 2014 5:12 pm

Objects don't have names that you can store, but you can give them a variable and assign it a value to whatever you want. EG: Objectname.

Ideally you want to store the UID or (Unique identifier) which each object has. so that you can refer to that specifically later.

to store it into an array like you wanted to do.

(system) For each (object) -> (array) set at X = Loopindex, value = (object.UID)

this will put the UID of each object into the X position of the array as it loops through each object in the scene
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Wed Nov 05, 2014 7:36 pm

Thanks for the reply Justifun.
I got quite far since posting my original question and I have the names of my objects stored in an array quite nicely.
So, I have something like this:

0,red,yellow,blue
red,0,0,0
yellow,0,0,0
blue,0,0,0

As you can see, it's basically a grid with names across the top and down the side.

What I wanted to do next.... which I can't figure out, is cross reference the grid.
I wanna be able to look along the X axis (Red) then down the Y axis (Yellow) and were the two meet up, set to orange! Then the same with X=Yellow, Y=Red....

Then, later on, I want to be able to do the same thing with looking up where the X and Y meet and have it result in 'orange'. You get what I mean, I'm sure.

Where the X=red and the Y=blue, that would be purple and so forth.

I hope you can help as I'm quite stuck on this part.
Cheers.
B
7
Posts: 33
Reputation: 341


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Bootfit, Exabot [Bot], Google [Bot], Huemerson, unicornspitfire, Yahoo [Bot] and 3 guests