Title Case function is not working when I try it in Inform 7

72 Views Asked by At

I've set up my game to let the player choose their own name at the start as per the documentation, however, the line used to put it in title case is not working. Every time I start the game the player's name is displayed in lower case.

Code:

The player's forename is an indexed text that varies. The player's full name is an indexed text that varies.

When play begins:
    now the command prompt is "What is your name? > ".;
    no.

To decide whether collecting names:
    if the command prompt is "What is your name? > ", yes;
    no.

After reading a command when collecting names:
    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 command;
    now the command prompt is "> ";
    say "Thank you, [player's forename].[paragraph break]";
    say "[banner text]";
    move the player to the bed;
    reject the player's command.

And here's what I'm getting out of it:

What is your name? > Squiggle Squiggleson Thank you, squiggle.

The Children of Tragedy An Interactive Fiction by Luke Tooze Release 1 / Serial number 131216 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

squiggle's Bedroom (on the bed) As you lie in your unmade bed - staring at the ceiling - you realise you should probably get up and face the day.

I have tried many variations and Inform is allowing it every time but it doesn't actually change the case. Please help?

1

There are 1 best solutions below

0
On BEST ANSWER

You set the case of variable player's full name but then set the forename based on the original input (player's command) which still has the original case. Change the second line in the after reading a command rule to:

now the player's forename is word number 1 in the player's full name;