Page 1 of 1

Nested Variable

Posted: Tue Mar 19, 2019 7:34 pm
by beneee
Hi All,

Hopefully this is not a duplicate question as i have searched and I have the terminology correct but i am trying to get a nested variable working, here is a crude example of the code that I am attempting to get working.

- Variables -
ActiveTeam = 1
Team1Colour = Red
Team2Colour = Green
Team3Colour = Blue

- Program Output -
Your team Colour = Team(ActiveTeam)Colour

I really hope that makes sense.

Thanks
Ben

Re: Nested Variable

Posted: Wed Mar 20, 2019 10:41 am
by Benj
Hello,

It sounds like you maybe need a multi dimensional array.

TeamColours[2][3]

Would give you two teams each with three colour values.

You would then reference like this.

Red = TeamColours[ActiveTeam][0]
Green = TeamColours[ActiveTeam][1]
Blue = TeamColours[ActiveTeam][2]