0 votes
by (360 points)
Hi ( ^_^)/

At the begining of the game, I am having the players to input their name into $name

At some point I want to refer to the number of letters their name has, but I wasn't sure how I go about and do it

Any ideas?

1 Answer

+1 vote
by (156k points)
selected by
 
Best answer

The 'name' in the $name variable will be a String value, as explained in the linked documentation you can use that data-type's length property to determine how many characters are in the value.

(set: $name to "Jane Doe")

your name is $name, which has (print: $name's length) characters (including the space)

 

by (360 points)
Yes, Thats what I was looking for, Thank you very much (^_^)/
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...