# [ Resolved ]How do I [ ARRAY ] Get Y value of X

Get help using Construct 2

### » Sun Aug 17, 2014 6:11 pm

Hello,

I use the Inventory Systemmade by EncryptedCow.

Then i would like to know if someone know how to :

- Set one text to the value Y of X ( Something like Get the value stored on Y axis of a specific X like x = 1 or 2 or 3 etc ... )

Then after

- When i do one action Substract1,2,3,4 etc ... point from the Y value of the specific X ( Approximatly same thing as up, but instead of Set the text to, substract a certain amount from the Y value )

Hope someone can help me =) Thank you =D
Last edited by oOScuByOo on Sun Aug 17, 2014 10:58 pm, edited 1 time in total.
B
21
S
9
G
3
Posts: 70
Reputation: 2,729

### » Sun Aug 17, 2014 9:09 pm

No one know how to do it ? ^^
B
21
S
9
G
3
Posts: 70
Reputation: 2,729

### » Sun Aug 17, 2014 9:36 pm

You use At(X,Y) to get a specific value. Array.At(3,0) is referencing X=3, Y=0. To subtract the value at that index:

Array.Set at XY, where X=3, Y=0, Value = Array.At(3,0)-1
B
72
S
22
G
290
Posts: 3,885
Reputation: 159,511

### » Sun Aug 17, 2014 9:43 pm

Or after selecting the correct x thorugh events you could use:
Array.At(Array.Curx,5)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Sun Aug 17, 2014 9:49 pm

Thank you blackhornet, the problem was with this Inventory the object don't spawn at specific slots, they spawn randomly.
So the object can be one moment at X=1 and another moment at X=9 =s ...

Then is there a way for specify it =s ...

Exemple :

The Object Sword have the ID_3 and is on the Slot 4 ( X=3 ) one time after it was at Slot 1 ( X=0 ) so how can i get at evry time is position ( X=... ) for apply the At(X,Y) =s ...

Thank you =)
B
21
S
9
G
3
Posts: 70
Reputation: 2,729

### » Sun Aug 17, 2014 9:56 pm

Something like

array for each x
system compare two values array.curvalue=3
- set text to array.at(array.curx,5)

ofcourse 3 should be a unique value in this case..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Sun Aug 17, 2014 10:58 pm

Thanks for all the help given =)

Stain this is the good solution =), i have modify a little bit ( just add a function for set text to 0 if X don't check the value =D

Big thanks to you two =) ( Not U2 ... Stain and BlackHornet XD )
B
21
S
9
G
3
Posts: 70
Reputation: 2,729