How do I add a string and an instance variable to a string, then use the string to check a variable?

0 favourites
  • 3 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I have a bunch of skins in a game I am making, and each skin has a global variable to check if it is unlocked or not (Example: BallSkin1, BallSkin2, etc. 0 means locked and 1 means unlocked). All the buttons to switch skins are just the same sprite with an ID instance variable so I know what skin it is. I want to check if the skin is unlocked, but can't figure out how to use the same "base" event for all of them instead of making 35 copies of all those events. I need to make a way to merge the string "BallSkin" and the ID variable, then return that without it being a string (so the skin with ID 4 would be "BallSkin" & 4 to make BallSkin4).

    I am trying to use "BallSkin" & SkinButton.id to make this, but it isn't working for some reason.

    Is there a way to return that as a non-string to check for the global variable?

    Sorry for all the reading :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't do it because you need the 35 conditions to check if each global variable is set. You can't create the variable name in that way. If you used an array for the data probably you could do it in one or two events.

  • You can't do it because you need the 35 conditions to check if each global variable is set. You can't create the variable name in that way. If you used an array for the data probably you could do it in one or two events.

    Okay, thanks 👍

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