Display array child name dynamically?

So i have array variable with 3 child which are string

What i would like to do is being able to cycle trough these variable
Like add 1 to SpecialWeapons vairiable index child to cycle trough them

And have expression like GlobalVariable(SpecialWeapons.[ValuOfCurrentChildIndex]) well in this case it would display in text object A B or C

Is that possible to achieve?

Arrays are set and read with variableName[index] You don’t need a period before the brackets. The index can be a number or variable or any expression that returns a number.

Example: This uses mod() to allow the index to loop back to 0.

Or you could use conditions. This uses the left and right keys.

The second event subtracted 1 because indexes start at zero. So, the last index will always be the child count -1.


I can’t believe i am abusing variables for over a year left and right and this was not obvious to me

I was able to figure out mod/switch part of it
I was not able to figure out how to display current child value by index number instead of straight up declaring it

And documentation was not clear on that


1 Like

The documentation on variables is weak and it’s made worse when the autocomplete doesn’t always work within the brackets.

Documentation is tragic when it comes to examples
It explains the idea but do not give you enough practical examples to understand it

Even mod expression its perfect example even so most of them are guilty of same sin
I know how mod works and how to use it
But please tell me what i am supposed to understand from this description?

And there is no example in documentation for it
Where some have enough info to understand it even without examples

One day i gonna ask mods can i add examples and/or descriptions to them
Because it is just tragic in current state

Anyway THX again