
How can i add to a specific array variable with a equation
I would like to have
Nonsence.ItemAMOUNT[ToString(ArrayTools::IndexOf(Nonsence.ItemInventory,IDTHINGYYYY.Data))]
but it seems i cant use equations :C
IDTHINGYYYY.Data is a variable that tells the game what item to give you
The array variable name shouldn’t be in quotes. Neither should the index inside the bracket. Plus, if it’s an array, it should be a number, not a string.
Nonsence.ItemAMOUNT[ArrayTools::IndexOf(Nonsence.ItemInventory,IDTHINGYYYY.Data)]
Arrays use numbers while structures use child names that are strings. If it’s an array, it needs a number.
If you’re not positive that the value will be in the array then you need to check if it exist first otherwise the search expression returns -1 and would try to add the index at -1 which would probably just return the value 0 to avoid crashing.
This is my test project. List has the data that is searched , Output is the destination.
It uses a button for testing and a text object to display the array values using the variable child. The variable POS is used for the position.
My test project just adds the number if it exists in the other array.