[SOLVED] Trouble with Inserting Variable in Array at Specific Index

I’m using the ArrayTools extension and I don’t fully understand how to insert variables at a specific index in the array. If there is another way to insert string variables into an array at a specific index, I’d like to know.

The variable “waka” is a String scene variable, and the array “testArr” is an Array scene variable.

My event sheet looks like this:

I was expecting the results to look like

"testArr" : { 
   "type" : "array"
   "value" : ["www"]
 }

but the results look like this:

All of the values in testArr are 0.

Thank you for the help!

Array Tools uses JavaScript for the variables both variable names need to be in quotes without the VariableString part. Just the variable name.

Edit: Vaiable www was created because it treated the value of waka as a variable name. All of the array elements were added because variable www was created with a default value of zero and since there wasn’t a condition like at beginning of scene the actions repeated on every frame inserting element zero and pushing the existing elements down a place.

1 Like

Ahh, that makes a lot of sense.

Thank you!

1 Like