Two identical strings don't seem to match.

0 favourites
  • 4 posts
From the Asset Store
Match 3 Game Gem Pixel Art work for any kind of Match Games.
  • I have two strings which appear identical. One is set up in a local string variable, as '442' and the other comes from an array and is also '442'.

    I've put them side by side on the screen and they both look exactly like that, but for some reason, a C3 match doesn't want to match them (i.e System String1 = String2 isn't triggering).

    I've tried trimming them both (e.g System trim(string1) = trim(string2)) but it's still not triggering.

    Am I missing something else that can make identical looking strings not match up?

  • I think this might actually be a bug in C3. I can run a check if anyone is interested, e.g Ashley?

    Basically, when I did the comparison between a string and the string in the array, it didn't match. But when I put the string in the array into another string and then compared the two strings, they matched. Not sure if I did something wrong somewhere but it does appear that a string in an array isn't the same as a string.... maybe that's as intended?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe the string you are pulling from the array is treated like a number? "442" is not equal to 442

    Try adding str() to it.

  • Yep, you're spot on, that was the problem and adding str did fix it. Good to know for the future as I'll be using this string array quite a bit in my project.

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