Add to an array index?

If DIALOGUE2 is an array, use DIALOGUE2[0 + <variable_name>].

But if it’s just from index 0, then just use DIALOGUE2[<variable_name>]

its not working? is there some other way? or extension

First of all the action parameters don’t look right. The Variable field needs to point to the specific index - otherwise you are changing the entire thing to a text value. So Variable field should be like “yourArray[index number]”. Then Value field is whatever you are changing that element of the array to. You wrote “DIALOGUE2.0”, a string. So as it is you would just get a string variable DIALOGUE with the value DIALOGUE2.0 which is probably not what you want, (and not even an array)

The way you phrase the question however makes it sound like you just want to increase the size of the array? Or are you trying to go through the array element by element?

element by element
if your saying going through each structure variable?

i have a variable named dia2.1 and I’m trying to add to dia2.0

Ok, if you want to just run through the entire array then you can use the special event “repeat for each child”.

Or you can use a different variable such as dialogueIndex that just stores the index number you are working on. You can then access the array with dia2[dialogueIndex].

variables:
  index = -1
  dialogue = array
     0     something
     1     something else
  currentString = whatever

events:
  <condition>     |     add 1 to index
                  |     currentString = dialogue[index]

this will change currentString to “something” the first time it triggers and “something else” the second time (and then it will give you a 0 if you go past the end of the array, keep in mind!)

Can you screen shot the event?

And is DIALOGUE2 an array or a structure? Because your initial screen shot didn’t highlight the value as an error, which suggests it’s a structure.


So dia2[0] = dia2[0] + dia2[1]? Then try:

sorry its a structure i think i figured out a work around ill try it later

Then use DIA2["0"+ <variable>]. That will concatenate ‘0’ with the string value of the variable.