Handling blank input when naming, solved.

Hi, a while ago I came onto this forum asking this: I want a prompt for the player to enter their name, and if they leave it blank, to provide a default name. I was told that this was impossible without some i6 hackery. Well. I figured out a way. It’s a little hacky, but only at the I7 level.

Here it is.

[code]“The Name Game” by Another Wannabe

The stage is a room.
“It is a colorful room full of stage lights and such.”

The host is in the stage.
“The host looks dapper in his awesome suit.”

The player’s name is a text variable. The player’s name is “”.

When play begins:
say “You are at a game show when the host gestures at you grandly. ‘May I present… the next contestant!’[paragraph break]‘Me?’ you say in bewilderment.[paragraph break]‘You! Yes, you! Come right up. All you need to do to win $1,000,000 is tell us your name!’”

naming mode is a truth state variable. naming mode is true.

After reading a command when naming mode is true:
now the player’s name is the player’s command;
now naming mode is false;
say “‘My name is [Player’s name],’ you say nervously.[paragraph break]’[Player’s name]? What a wonderful name!’”;
reject the player’s command.

Rule for printing a parser error when naming mode is true:
now the player’s name is “Pat”;
now naming mode is false;
say “‘Shy, are you, little person? Let’s call you [player’s name].’”

The game show is a scene.
The game show begins when play begins. The game show ends when naming mode is false.

When the game show ends:
say “‘Look everyone! [Player’s name] is our winner!’[paragraph break]You jump for joy. All your dreams are come true!”[/code]

Hope this is useful to someone.