How do I choose between different global variables?

Get help using Construct 2

Post » Sat Mar 07, 2015 7:20 pm

Hi there,

The name of the topic aint great, my apolagies :)

I'm trying to figure out the following. I want to set a instance variabel to value that is within a Global Variable and lets say the global var is called Gvar1.
But I also have a Gvar2, Gvar3 and Gvar4.

For this example the instance variabel has another number variabel that changes from time to time. Based on that number I want to call/use the correct Global Variabel that has the same number at the end.

I want to do this within one event. Is it possible when setting the value to use something like Gvar&the correct number? I cant simply enter Gvar&str(2) since I get the error that Gvar is not a system expression. But I have no idea how to fix it or convert it to the actual Global Variabel. Is that even possible? :)

Thanks!
B
24
S
3
Posts: 42
Reputation: 1,134

Post » Sun Mar 08, 2015 10:41 am

This is a great example of when you'd want to use an array instead of global variables. Basically, you'd have an array ('array', for instance) , and you'll be able to access the stored values with array.at(0), array.at(1) etc.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,699

Post » Sun Mar 08, 2015 1:26 pm

Ah thanks! Didn't think of that. This morning I actually started to do some tests with the dictionary and that seems to also do the job.
B
24
S
3
Posts: 42
Reputation: 1,134


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests