Array, child variables

The arrays “Variable” and “SceneVariable” contain 7 child variables, type “text”
Each variable in the “SceneVariable” array has its own text set.
In the game, the text value from the “SceneVariable” array can be changed by the user.

Is it possible to shorten this event?

1 Like

IDK if there’s anything in the Array Tools extension but if you want to copy the entire array to another array you can use Json.

The expression ToJSON() converts a variable to a string with Json. The action then converts the text to the variable name. This will completely overwrite the destination variable.

Action
Screenshot_20250102_123316_Chrome

Another approach would be to use repeat or for each child to go through the array an index at a time.

2 Likes


im not 100% sure but try something like this, it should loop through each child of Variable and set it to a SceneVariable child with the same index. Also n is a number variable

1 Like

It’s working, thanks.

Is it possible to save the entire array in storage without specifying a separate element in the array?

Yes. This post has links to 2 other posts.

It also uses Json. Convert the array to string with json and then save the string to storage.

To load it, you load the string and convert it to a variable.

Sometimes you can use the json string directly other times you need to use a variable to temporarily hold the string before converting it back to an array variable.

1 Like

GD will evaluate both sub-conditions but it will only trigger once as long as at least 1 is true. It would be best to use 2 separate events. One for each storage.

Just for reference, the OR condition evaluates all sub-conditions even if the first one is true. If there were objects in the conditions it would test the conditions and pick the matching objects for each condition if the conditions were true.

1 Like

Yes, I came to the same conclusion.

1 Like