Converting a string into a variable name

Get help using Construct 2

Post » Fri Jun 01, 2012 9:47 am


Hi ev'one!

A newbie question:

I have a list of some twenty variables that have to be shown one or another depending on the circumstances. These variables are named topic1, topic2, topic3... topicn. My idea is to have dinamically stablished the name acording to the circumstances, like:

    topicFinal = "topic" & n

and using topicFinal as the variable to be made visible, to change, etc.

Is that possible? Is there another way? Is too much newbie a question?

Thanks!

rahms
B
10
S
1
Posts: 8
Reputation: 785

Post » Fri Jun 01, 2012 11:22 am


A newbie question indeed!

Using an Array solves the problem!

rahms
B
10
S
1
Posts: 8
Reputation: 785

Post » Fri Jun 01, 2012 2:03 pm

you can also use the Dictionnary plugin. If I were to emulate dynamic variables that what I would use.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Fri Jun 01, 2012 3:26 pm

Nice, thanks for pointing out @Yann, I was looking for this option myself.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Fri Jul 27, 2012 9:13 am

Thanks Yann!
B
10
S
1
Posts: 8
Reputation: 785


Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag and 31 guests