Combining Local Variables and Text to call a Global Variable

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I want to create something that will save me time and lines of code in my game, but I can't get it to work properly...

    what I want is to be able to combine two or more information to call a Global Variable. ex.:

    if button is pressed

    Set localvariable.X to localvariable.Y & "_some_text_" & localvariable.Z

    knowing that there is a Global Variable called localvariable.Y_some_text_localvariable.Z that I want to be called by this function.

    Is there a way to do it? and if it is how?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nope.

    Construct 2's syntax completion will look into having the actual correct name for the variable right away (localvariable.Y_some_text_localvariable.z) as a single block for it to make sense.

    Consider using the Dictionary plugin which you could mess with the key name using string manipulation as you are looking to do.

  • OMG THANKS!

    I never got to use the dictionary plugin before, and now I don't know how I was making stuff without it! It is working the way I wanted! sure because I need to use the dictionary I will need to add some lines to the game, but still gonna save me time, and lines in the game! THANKS SO MUCH!!!

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