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
Posts: 8
Reputation: 635

Post » Fri Jun 01, 2012 11:22 am


A newbie question indeed!

Using an Array solves the problem!

rahms
B
10
Posts: 8
Reputation: 635

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
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

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
Posts: 8
Reputation: 635


Return to How do I....?

Who is online

Users browsing this forum: chcteacher, qaisarehman and 19 guests