How do I choose between different global variables?

0 favourites
  • 3 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • 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!

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)