[SOLVED] Read multple lines in an text input

Hey, i’m trying to make an text-input based game where the player can control the character, so for example if player enters in input:

move(1) then it will move him by 16 pixels, however i want it to be able to read multiple lines, example:

move(1)
move(1)
move(1)
move(1)

which will move him by 64 pixels. or:

repeat
move(1)

which will continously move him

You can use the array tools extension. It has an action called Split string into an array. You can then use for each child variable to go through the array and compare the text. You might need to use text manipulation expressions to find values within the lines.

Here are the events using a button object, text input and text object
(if the button is pressed, it clears the text object, splits the input text to array list and then goes through the list and add it to the text object.

Text Manipulation
https://wiki.gdevelop.io/gdevelop5/all-features/string-instructions/reference/#text-manipulation

1 Like

Thank you so much! You really helped me out

1 Like