How do I sort an array by writing

0 favourites
From the Asset Store
A cool way for kids to write and practice English Alphabets
  • > So what are you trying to do in the textboxes?

    This code should be clearer

    https://www.sendspace.com/file/3550lc

    The first thing I would like to understand is why when writing the letter "p" in the input text there is the word potatoes and not pear, I wish there was pear because putting the words in alphabetical order it comes first

    The problem is that you loop and add each matching value that it finds to "InputTestuale" textbox, that's why you see potatoes as you never stop the loop when it finds the value "Pears" first and because Patataos is the last word that it finds then it will be the one that last shows on the Textbox.

    You can avoid this by for example just adding a boolean to know when the first match value is found and added to the textbox so you dont add any more values after that.

    Here is an example:

    https://www.dropbox.com/s/gp9xg1sjgxdjtzr/fruits%20text2.c3p?dl=0

    Note:

    1-The wait for previous actions only works with actions that take longer than a tick to complete, you will see the timer next to them at the Right, so you dont really need it here.

    2-Remember to sort your Array before you start the Search Loop

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much, I was still trying to figure out how to do this, it seemed strange that the first word could not be found!

    This is exactly what I was looking for, you are great!!!

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