Compare Variable -> Skip Upper Cases / Match 75% of string

0 favourites
  • 10 posts
From the Asset Store
Various Bell Sounds (from small to huge) / 35 Unique Clips / 2:46 minutes of audio
  • Its possible to do this in construct 2? i want for example use Compare variable or Pick by comparision, i want to skip UPPER CASE and if the string match 75% of letters then the value will be correct, for example variable 1 value: PineApple , if my other variable 2 its pienaple then my value will be correct.

  • You can use 2 array (size = len(variable) and compare each letter (you can use lowercase(variable) in order to convert each variable)

  • Nvm, understood it... I think.

    https://copy.com/EjoQsnxgYyJL1DYK

    like this maybe.

    it ignores upper case letters, and for each lower case letter it tests whether it matches or not, ignoring order. Then you get a number of matches and non-matches.

  • Nvm, understood it... I think.

    https://copy.com/EjoQsnxgYyJL1DYK

    like this maybe.

    it ignores upper case letters, and for each lower case letter it tests whether it matches or not, ignoring order. Then you get a number of matches and non-matches.

    Thank you so much!!, without the help of this community i think i had given up, i spend the whole day trying to modify your code to use spritefont and text object but i cant do it <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad"> , on text changed dont exist in spritefont / text object, i dont know why i cant understand this, how much tutorials i need to made to be a pro like you? lol.. please help me to fix this, i tried too to destroy objects that you wrote the correct value but didn't work too.

    http://www.filedropper.com/comparingv2

  • https://copy.com/uYqaoQi11F4wquXg

    I still dont really get what you want to achieve with this. If you want to compensate for typos, then it would be better to employ levenshtein distance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • copy.com/uYqaoQi11F4wquXg

    I still dont really get what you want to achieve with this. If you want to compensate for typos, then it would be better to employ levenshtein distance.

    Thank you again for your help!! , i was reading about levenshtein distance, i saw your .capx here ( ), with levenshtein distance you can replace or suggest words?

    For example you started to write -> ap and then in the text object or sprite font you get very fast the word-> apple ? before you write the complete word?, your .capx show me levenshtein distance value but i dont know how to implement it.

    I am trying to find .capx examples in the forum about compensate for typos but i cant find anything, i think this is hard to made by me .

    I just want in my game that the people dont have to worry about write the complete word or partial wrong word and dont waste time writing complete words, for example you can write mou and you get very fast the word mountain in the text object or sprite font or if you write ineap you get very fast the word pineapple

    However if i have Sprite Objects in the layout with the two words mouth and mountain then you need to write moun to get the word mountain or mout to get the word mouth but only if you have two sprite objects in the layout with similar word.

    The difference with comparingv3.capx is that with levenshtein distance system you only need to write "ad" and you get instantly in the text object or spritefont the word "advertisement", instantly set var1! and after 0.5 or 1 second clear the text object to write the next word.

    You are very smart, you understand more what i want that I myself, I'll be very grateful if you help me with this.

  • Levenshtein distance is the number of operations/edits you need to do, to change one word into the other. The regularly used weighting is:

    1 for substitution (example: 1 wrong letter typed)

    1 for deletion (example: 1 letter too much)

    1 for addition (example: 1 letter missing)

    So you could say you allow 1 typo in the word, then for red stuff like this would be allowed:

    reed, ret, rad, rwd, rd, ...

    Of course you could make it reliant on word lenght, so for example forbid typos in short words, but accept one or two in longer words.

    Word suggestion is something different and would use a dictionary, preferably one which knows the frequency of words in common usage, to suggest the most frequently used word(s) that begin with the typed letters.

    Would it not be a problem in your game, if autocompletion is too strong? (it could get weird for the players if all they do is write out words half-way and then the next task already comes up)

  • Levenshtein distance is the number of operations/edits you need to do, to change one word into the other. The regularly used weighting is:

    1 for substitution (example: 1 wrong letter typed)

    1 for deletion (example: 1 letter too much)

    1 for addition (example: 1 letter missing)

    So you could say you allow 1 typo in the word, then for red stuff like this would be allowed:

    reed, ret, rad, rwd, rd, ...

    Of course you could make it reliant on word lenght, so for example forbid typos in short words, but accept one or two in longer words.

    Word suggestion is something different and would use a dictionary, preferably one which knows the frequency of words in common usage, to suggest the most frequently used word(s) that begin with the typed letters.

    Would it not be a problem in your game, if autocompletion is too strong? (it could get weird for the players if all they do is write out words half-way and then the next task already comes up)

    isn't a problem because if i have for example two sprites objects ( mountain - mouth ) my players can see the objects and they will know before they write the meaning of the object, they will write moun or mout and they will get the word instantly in the text object / sprite font, and they will see of course the complete word for 0.5 or 1 second in the text object so they will know that they wrote the correct meaning, with this method i remove a lot of friction in the game, of course if i don't have objects visible in the layout with similar letters then they will only need to write for example mo and they get instantly the word mountain.

    Another example the words power / flower , if two sprite objects exists in the layout with this words, of course they will need to write the po or fl character, this will be a anti-friction system, if the player don't know the meaning of the sprite object they will give up or write incorrect meaning.

    If you see an Apple Sprite Object you will write ap and you get apple instantly, you prove to the game and yourself that you know the meaning of the sprite object, in the game this is enough to prove your knowledge otherwise if you write the wrong meaning for example ora because you think that the sprite was an orange then i can set a message in the text object like wrong meaning if none of sprite objects in the layout contain the letters ora, then the player need to write again the meaning, so with this anti-friction system you can get good answers and bad answers at the speed of the light, and its enough to prove the knowledge of the player.

    I am testing with your comparingv3.capx , 3 letters looks good, however i think auto completion cause more friction than the actual system because the player must write the word and wait to see the complete word in the text object, the auto completion must be maybe in the variable but not visible in the sprite object, then you know that you can write the first 3 letters of the word or the complete word but with mistakes and you get the correct answer, the bad of the actual system comparingv3.capx is that if you write a wrong word and the sprite object with the wrong word don't exist then you need to press back space to clean the text object to try again, this cause friction, to remove this friction i need that if the player write the complete wrong meaning or the word dont have letters of any sprite object visible in the layout then they get the text object clean very fast.

    The actual system comparingv3.capx isn't precise because if i write mont or monta i cant get correctly the value "mountain" then i need to write again the meaning and this cause friction, the players needs to know that they only need write the word partially correctly or only the first 3 letters to get the answer good, some lazy players will write the first 3 letters, other players will type fast the complete word but they don't need to worry about typo mistakes, i think you understand my point, remove any friction in the game and then you can have a rain of sprite objects, you only need to write the meaning without friction.

  • "mont or monta i cant get correctly the value "mountain" " -> because you need at least 75% of the letters of the target word.

  • "mont or monta i cant get correctly the value "mountain" " -> because you need at least 75% of the letters of the target word.

    UPDATE: after an hour of trying i found how to write complete words, i just disable global variable wait

    I am testing now the friction, i think auto completion will works ok, how i can make the auto completion system?? please if you have a good tutorial for newbies or something... i want to learn mainly, i am trying to understand your code in comparinvg capx.

    I designed this capx to test the friction.

    http://www.filedropper.com/comparingv4

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