How do I compare word in a text?

0 favourites
  • 11 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • I want to do this ;

    If text sentence have "ball" word -> make text color =[rgb (255,255,255) Example text object : "The ball rolled across the lawn."

  • simplest way.... [Plugin] tag text

    redTagText.capx

  • simplest way.... [Plugin] tag text

    redTagText.capx

    You and rax are a savior! Thanks.

  • If you want to make the whole text red then you could also just use find(txtBox.text, "ball")

    Scroll down to the Text section and several expressions you can use: https://www.scirra.com/manual/126/system-expressions

  • If you want to make the whole text red then you could also just use find(txtBox.text, "ball")

    Scroll down to the Text section and several expressions you can use: https://www.scirra.com/manual/126/system-expressions

    Ok,i got this but another problem appeared <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    Can i compare a letter in textbox.text ?

  • Ok,i got this but another problem appeared

    Can i compare a letter in textbox.text ?

    It would be the same just replace "ball" with the letter ("r")—not sure I understand what the problem is...

  • >

    > Ok,i got this but another problem appeared <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    >

    > Can i compare a letter in textbox.text ?

    >

    It would be the same just replace "ball" with the letter ("r")—not sure I understand what the problem is...

    Sorry,my bad.

    I'm making a word search game.

    I have a word list.

    I load this list with ajax.

    I give randomly 8 letters and player should create words using those letters.

    Here's my problem;

    I can't check player is used my letters or not.

    Ugh! I can't explain my problem because of my english. <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    Here's my capx : https://drive.google.com/file/d/0B9xK1e ... gxcWc/view

    In this screenshot i entered "float" but those letters are different than the letters which are created by game below.When i entered "float" the game search the wordlist and founds "float" and says "it's ok" and give me points.It should be wrong because i didn't use the letters which are created randomly below.

  • Okay, I think I get your situation. I can't look at your capx now but will try to tomorrow if you are still having problems.

    So I assume from this they are typing in the letters on the keyboard?

    One idea off the top of my head is instead of using a textbox to detect keyboard input and only do anything if it matches.

    Either way, I would probably start by loading the letters into an array.

    Create a variable that starts as false (boolean or 0)

    Loop for array.width

    -if [letter to check] = array(loopindex) set variable to true/1

    If variable = true/1 then update text/allow the letter to be added.

    If you let them type anything in the textbox then you would have to check it after and remove as opposed to allow. But you can do the same in a nested loop

    Loop for textboxt.length

    -Loop for array.width

    --if [letter to check] = array(loopindex) set variable to false and end loop

    Can't look at the capx right now so not sure what you have already and if this helps or not...

  • Try Construct 3

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

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

    Thank you.Problem solved.

  • Wow, nicely done korbaach . Concise and effective. I gotta get myself more familiar with arrays

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