How do I Set text from array!(Solved)

Get help using Construct 2

Post » Sun Nov 01, 2015 8:24 am

hello all, I am stumped.

I have a 2d array, 0,0 the value is UID, Name

I want to set text to name from my array.

example:

1, bob
2, sam
3, josh


so if I select an Object(Josh) hs data is stored in the array, how do i set text to the y of my array to pull the name? I tryed array.at(object.UID, 1) the UID is set and loaded into the array in the x position and the name is generated and placed in the y position. and now clicking on the object i want to display that random name from the Y position in my array.
Last edited by mordiaky on Sun Nov 01, 2015 3:41 pm, edited 1 time in total.
B
8
S
1
Posts: 72
Reputation: 721

Post » Sun Nov 01, 2015 8:50 am

mordiaky wrote:.. and now clicking on the object i want to display that random name from the Y position in my array.

If I understood correctly...
Image
Image
B
64
S
23
G
7
Posts: 1,482
Reputation: 10,825

Post » Sun Nov 01, 2015 3:14 pm

Not quite,

I am working with a 3,2,1 array.

index 1 = Object.UID, "Name1"
index 2 = Object.UID, "Name2"
index 3 = Object.UID, "Name3"

when I load the game I have one sprite that spawns 3 so each one will have a unique UID, I also have a random name generator and it adds it to the Y of the array matching the UID to store the data. Now when I am in the game and select the Object I have a text that should display its name only, how do I get the Y from the array in the text?

so if I select Objust.UID 25 my code will search in the array for object.uid 25 now from that I want to display the name it was given.
B
8
S
1
Posts: 72
Reputation: 721

Post » Sun Nov 01, 2015 3:42 pm

Figured it out!

array.At(array.IndexOf(object.UID),1)
B
8
S
1
Posts: 72
Reputation: 721


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Google [Bot], part12studios and 8 guests