Remove the letters in a text by order by button press

Get help using Construct 2

Post » Wed Sep 17, 2014 12:26 am

how do I remove the letters in a any text in a spritefont/text by order by button press
B
34
S
6
G
2
Posts: 243
Reputation: 3,040

Post » Wed Sep 17, 2014 2:29 am

As per your other thread, use mid() again.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
22
G
249
Posts: 3,763
Reputation: 138,577

Post » Wed Sep 17, 2014 4:08 am

whoops meant by key press but thanks this makes it easier to understand of sorts :)
thanks again @blackhornet
B
34
S
6
G
2
Posts: 243
Reputation: 3,040

Post » Thu Sep 18, 2014 12:23 am

can you explain this to me ?
Finish.Text & mid(Start.Text,0,1)
mid(Start.Text,1,len(Start.Text)-1)
B
34
S
6
G
2
Posts: 243
Reputation: 3,040

Post » Thu Sep 18, 2014 1:02 am

mid() has three parameters: text, index, count

'text' is self explanatory

'index' is where to start extracting the text from. Computers start counting at zero, so if we put zero here, we start extracting the text from the beginning of the 'text'. If we use 1, then we skip the first character and start extracting from the second character.

'count' tells us how many characters to extract. So in the first case, mid(Start.Text,0,1), we extract one character from the beginning of the 'text'.

len() returns the count of the number of characters in the text. So len(Start.Text) returns whatever the current length of the text is at the moment.

So, mid(Start.Text,1,len(Start.Text)-1) counts the number of characters, and subtracts one, as we want to extract all the characters EXCEPT the first one, so we need one less character than we started with. So starting at index 1, and extracting 1 less that the full length of the text gets us all but the first character.

Finish.Text=Finish.Text & mid(Start.Text,0,1) takes the current text and adds the first character of the Start text to the end of itself.
Start.Text=mid(Start.Text,1,len(Start.Text)-1) sets the Start text to itself minus that first character.
ImageImageImage
B
71
S
22
G
249
Posts: 3,763
Reputation: 138,577


Return to How do I....?

Who is online

Users browsing this forum: Christmas and 22 guests