Capturing Three Features About Player At Start Of Game?

Hi all, newbie here to Inform 7. Love it.

I am using some of the examples and have found ‘Identity Theft’ and ‘Pink or Blue’. The first asks for the player’s name and the second asks if they are male or female. I would like to add a third question (what is the name of your boat).

Unfortunately I haven’t quite got my head around the correct syntax to get this to run properly. So far I have it asking the player if they are male or female and then their name. This is the wrong way round. I’d like to ask name, boat name and then male or female.

This is what I have pasted from the examples. I know this has something to do with conflicts between ‘When play begins’ and ‘move the player to the location;’, but I can’t get my head around it.

Any pointers?

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 "And what name do you wish to go by? > ".

To decide whether collecting names:
	if the command prompt is "And what name do you wish to go by? > ", 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]Who are you, a member of the British royal family? No one has that many names. Let's try this again.";
		reject the player's command;
	now the player's full name is the player's command;
	now the player's forename is word number 1 in the player's command;
	now the command prompt is ">";
	say "[paragraph break]";
	move the player to the location; 
	reject the player's command. 


[We also want to postpone the proper beginning of the game until we've gotten the name:]

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.



The player's boatname is an indexed text that varies. 

When play begins:
	now the command prompt is "And what is your boat name? > ".

To decide whether collecting boatname:
	if the command prompt is "And what is your boat name? > ", yes;
	no.

After reading a command when collecting boatname:
	if the number of words in the player's command is greater than 5:
		say "[paragraph break]That's a bit convoluted. Imagine repeating that name over the VHF in an emergency. Let's try this again.";
		reject the player's command;
	[now the player's full name is the player's command;]
	now the player's boatname is word number 1 in the player's command;
	now the command prompt is ">";
	say "[paragraph break]";
	move the player to the location; 
	reject the player's command. 


[We also want to postpone the proper beginning of the game until we've gotten the name:]

Instead of looking when collecting boatname: do nothing.

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

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



When play begins:
	say "Welcome! Before we begin, a couple of personal questions if I may. [paragraph break]Should your character be male or female? >";
	if men win, now the player is male;
	otherwise now the player is female;
	say line break.

[Now a piece of Inform 6 code handles the unusual input. It's not necessary to understand this to use it, and the code should work for any question you'd like to ask the player. The first three words in quotation marks ('male', 'M', 'man'...) correspond to positive feedback; the later three words correspond to negative feedback. So "to decide whether men win" will be true if the player types one of the first three, and false if he types one of the last three.]

To decide whether men win:
	(- Question('male','M//','man','female','F//','woman') -)

Include (-

[ Question pos1 pos2 pos3 neg1 neg2 neg3 first_word_typed;
	while (true) {
		VM_ReadKeyboard(buffer, parse);
		wn = 1; first_word_typed = NextWordStopped();
		if (first_word_typed == pos1 or pos2 or pos3) rtrue;
		if (first_word_typed == neg1 or neg2 or neg3) rfalse;
		print "Please choose ", (address) pos1, " or ", (address) neg1, ". > ";
	}
];


-)

I think I see what the problem is. You have three different rules that fire “when play begins.” One of them (the gender question) gets player input from I6, so it bypasses the normal command-reading sequence. That’s why it goes first. Both of the other rules fire at the same time, so the command prompt is reset twice before the first turn actually begins. The last rule to set the command prompt wins, and the other one is forgotten.

It looks to me like the example you’re cribbing from is a bit of a hack, and you’ve added more hacks to the hack. You might be better off starting fresh, maybe using Michael Callaghan’s “Questions” extension:

inform7.com/extensions/Michael%2 … index.html

Aha, that looks just the ticket. Thanks for bringing this to my attention, capmikee. Guess I should get more familiar with some of those extensions.