How do I limit the character amount for Text Entry

As a newcomer to this game engine, I find it very interesting! However, one part of it is still very confusing to me. By the title of the post, you can already see what I’m asking for but I did try and look for other posts that asked the same question except… theeey didn’t really help that much. So now I’m hoping for a fresh answer from someone reading this!

I feel like I can do this with some JS, and I am somewhat familiar with that language, but for this project I want to try and stick to Drag 'n Drop style of coding, but if JS is the easier way, then please do say so!

So in theory: is there any way that I could make it so that only numbers can be typed in a text entry and of course limit the amount of characters a player can type in?

And just in case, to further clarify as it’s really confusing reading this, I want all the numbers to be available to the player 0-9 but I want to limit them so they can’t input more than, let’s say 4 numbers.
So for example, if the player types in the year 1987, they can’t type in any more numbers, it needs to be stuck at the last number. Hopefully this helps.

You can do it analizing the text using the expressions system bundled in GDevelop. Also, the events offers all the conditionals and loops you need. There is no need of using JS to do this.

1 Like

I will take a look at this, thanks :slight_smile:



1 Like