Ask here your questions to get help using GDevelop.
User avatar
By Jeje2201
#65374 Hi,
Im trying to make the user type his username, but I don't want him to be able to set characters other than letters and numbers.
Using a regex filter would make it way more easier to check. But since we don't have that, I wanted to know any way to do it ?
The only way I found is to search a character into a text like that for a space :
And so if the variable Error1 is >=0 then I can tell there is a space, but doing that for all character, I don't think that's the best way; or it would be like way too much variable to check each characters that are not letters or number.
Is there any way to do so ? Thanks :)
Last edited by Jeje2201 on Fri 2 Mar 2018, 18:20, edited 1 time in total.
User avatar
By Lizard-13
#65375 Here is a "compressed" way to do it:
(21.53 KiB) Downloaded 73 times

There is a structure variable with a lot of childs, each child has the name of an allowed character:
Code: Select allAllowedCharacters
        a = 0
        z = 0
        A = 0
        Z = 0
        0 = 0
        9 = 0

(No, I didn't create child per child, I've edited the project file with Sublime Text :P)

Then, each time the Text Entry object is modified (a character is entered), the entire string is checked, letter by letter, using the structure variable to know if the letter is allowed.
User avatar
By Jeje2201
#65376 You're just a god :')

Imma make sure to give you credit when my game would be done!

I don't even know what limit you can have on game you can create with your knowledge :')