limit text input

Could someone please demonstrate how to limit the size of the text typed in the text input?

I’m a beginner and I’ve tried everything to no avail.
Help me

Hello @dpereira, just to be clear, you want to limit the amount of characters that the player can type?

Yes, I would like to limit the amount of characters he can type or limit the display of these characters.

Example:
He typed: California
I display: Calif

Thanks for all the help

I think the easiest way is to limit the amount of characters. You can use the expression StrLength() for that, as the name says it gives you the length of a string variable.

If you use the expression on the Text() parameter of the Text Input object, you can know the length of it, then you can prevent the player to write more text if he/she reached the limit you choosed, like :

StrLength(NewTextInput.Text()) > 5

I appreciate your help.
I had already seen similar response in questions from other users.

My problem is that I’m a beginner and I have no idea how to apply this solution, I see this code and I don’t know where to apply it or how to start.

Could you make me an example or print?

I would be very happy if you could help just a little bit more
Please…

This is one way to do it : you create two objects.

  • a Text Input Object called Input (for example)
  • a Text Object called Text (for example)

Text displays the text typed by the player in Input.

So you create a new event, with a condition “Compare two numbers”, and an action :

It means : if the text typed in Input has less than 6 characters, display the text. If not, nothing happens.

You can also store the text in a variable and use it somewhere else.