Compare a part of a value in array?

0 favourites
  • 7 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello there

    I have phrases text as values in array. I would like to compare just 1 word of the phrases, so one part of it of the values.

    For example:

    I like mushrooms

    I like spaghetti

    How do I compare the cells with just the word 'mushroom'?

    I can't use 'Contains value' for this, because that's only for the whole value.

    Can someone help me?

    Thanks!

    Tagged:

  • Hiya,

    Is there a definite need for the whole phrase to be in the array? You could possibly structure your game so that you have phrase + variable and the variable is always a single word from the array, but I don't know your game.

  • Hey thank you for your reply

    Yes, the phareses are needed, it's for a newsfeed simulation: notifications of different characters.

    If the player is deleting a character, every notification that had already been pushed to a queue in array of this character (finding notifications with the name in) must be deleted before it will be pushed to the actual newsfeed array... Maybe I can push on the Z axis the names beyond the notification of a certain character to recognize it, but I hope there is more easy way...

    kind regards

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm still difficult to understand the game as I cannot see it but maybe you can push character name with the phrase, so name is at 1,0 and phrase is at 1,1 ? There is probably an easier way to do what you are trying to achieve. if you're saying some notifications get pushed to a main array specific to a character then you could identify this in some way outside of the phrase. If you have very few characters maybe you could call from several different arrays?

  • Splitting name & notification (x and Z) seems like a really good plan!

    Thank you very much for your advice and options!

  • Maybe You could find the word in an array with something like this.

    http://www.sizzle-games.com/array_word_find.c3p

  • hey Siscoz

    Thank you very much for your advice and mock up!

    I took over your 'tokenat' tip succesfully!!

    I didn't know how to use it for an array

    kind regards, problem is solved!

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