Naming the Protagonist

So, I copy/pasted verbatim some text from the recipe book to allow the player to name the protagonist. It appeared to compile fine. I changed some of the text responses to be more in keeping with the tone of my project, but nothing in the coding. However, it resulted in a problem: The game never seems to stop “collecting names”, regardless of what the code says. That is, it always seems to think that the player’s last command should be used as a name, so that if the player typed “x desk”, and his/her name ought to have appeared in the resultant text, the name printed will be as “L At Desk”, regardless of what the player gave at the beginning of the game. Why is this happening?

Could you post the code in question?

I could, but I use a braille computer, which would make all the tabs disappear.

Even without tabs, it would be a lot easier to help you than with no code at all. :slight_smile:

I’ll take a shot in the dark here.

You’re saying something like ‘now the player’s name is “[the player’s command]”.’ In previous versions of Inform, assuming the player’s name was indexed text, this would set it to the value of the player’s command right at that moment. But in 6L02 onwards, this actually keeps a reference to the variable. So whenever the game tries to print the player’s name, it sees that reference, looks up what the player’s command is at the moment, and prints that.

Try changing it to ‘now the player’s name is the substituted form of “[the player’s command]”.’

Here is the code, sans appropriate tabs:

The player’s forename is a text that varies. The player’s full name is a text that varies.

When play begins:
now the command prompt is "Identify yourself: > ".

To decide whether collecting names:
if the command prompt is "Identify yourself: > ", yes;
no.

After reading a command when collecting names:
if the number of words in the player’s command is greater than 5:
say “[paragraph break]Invalid input. Please restate full name.”;
reject the player’s command;
now the player’s full name is “[the player’s command in title case]”;
now the player’s forename is word number 1 in the player’s full name;
now the command prompt is “>”;
say “Excellent. Welcome, [player’s forename]![paragraph break]”;
say “[banner text]”;
move the player to the location;
reject the player’s command;
now the right hand status line is “[time of day]”.

Instead of looking when collecting names: do nothing.

Rule for printing the banner text when collecting names: do nothing.

Rule for constructing the status line when collecting names: do nothing.

I think Draconis was right; try saying

now the player's full name is the substituted form of "[the player's command in title case]"

So that is the only part of the code that needs changing?

Looks like it to me, but I haven’t tested it myself.

Thanks! :slight_smile: