Player input syntax for names

I was sifting through the manual and here, on the forum, but couldn’t come up with an answer for this one. Perhaps I overlooked it, but I want the player to have the ability to input a variable, such as age and the correct syntax to call it when needed.

For example, at the beginning of the game, I want the game to ask the player for their name.

Later during game play, a NPC should be able to call them by name (ex: “Hello [player name], how are you?”)

Could someone help me with this?

The “Fido” example shows how make an action that would let the player name a dog.

You’d probably want to keep some aspects of that (taking input, setting up a property for the character with its name, making that property parse-able), but take out the “name” action that applies at any time during play, and instead ask the player for their name preference right at the beginning of the game in a When play begins: … rule.

You might want to check out Michael Callaghan’s Questions extension, which can take care of asking the question and validating the player’s response for you. After setting up your question, you’d just drop the player’s response into a global variable or (better) a property of the player object, e.g.:

[code] now the first-name of the player is the current answer.


say "Hello [first-name of the player], how are you?"[/code]