intfiction.org

The Interactive Fiction Community Forum
It is currently Tue May 21, 2013 7:18 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Jun 16, 2012 1:49 pm 
Offline

Joined: Wed Jun 13, 2012 9:14 pm
Posts: 14
So I've been fighting with this for a few days now. I've been trying to figure out how to modify the examples in the Recipe Book section 5.2 to let me do both of these things, but it just isn't working right. I don't actually get any errors, but it isn't working right in the game test.


My source

Getting Started is a room. Getting Started is private.

Gender is a kind of value. The genders are masculine, feminine, and nihil. Understand "male" or "man" or "M" as masculine. Understand "female" or "woman" or "F" as feminine.

A person has a gender. The gender of the player is nihil.

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 "Are you a man, or woman? >".

After reading a command when the gender of the player is nihil:
if the player's command includes "[gender]":
now the gender of the player is the gender understood;
if the gender of the player is nihil:
say "This story requires a selection of male or female. [run paragraph on]";
reject the player's command;
if the gender of the player is masculine, now the player is male;
if the gender of the player is feminine, now the player is female;
now the command prompt is "What is your name?";

To decide whether collecting names:
if the command prompt is "What is your name? > ", 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 ">";
move the player to The Chamber;
say "[line break] You wake up cold and disoriented...";
reject the player's command.



The game test gives me this.

Getting Started

Are you a man, or woman? >man
That's not a verb I recognise.

What is your name?john smith
That's not a verb I recognise.

What is your name?





Does anyone have any idea what I'm doing wrong?


Top
 Profile Send private message  
 
PostPosted: Sat Jun 16, 2012 4:42 pm 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 985
Location: Gothenburg, Sweden
You're almost there.

You need to end the rules with the phrase 'reject the player's command', or Inform will go on to process the gender and the name as if they were ordinary commands (and complain it doesn't understand them).

Also, the command prompt should be changed to "What is your name? > " rather than to "What is your name?" or the decide phrase won't recognize it.

_________________
Man ska inte tro allt man tänker.


Top
 Profile Send private message  
 
PostPosted: Sat Jun 16, 2012 5:41 pm 
Offline

Joined: Wed Jun 13, 2012 9:14 pm
Posts: 14
Could someone help me figure out where I'm missing the "reject the player's command;" text? I thought got the spot it was missing, but it doesn't seem to have made a difference.

Code:
Getting Started is a room. Getting Started is private.

Gender is a kind of value. The genders are masculine, feminine, and nihil. Understand "male" or "man" or "M" as masculine. Understand "female" or "woman" or "F" as feminine.

A person has a gender. The gender of the player is nihil.

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 "Are you a man, or woman? >".

After reading a command when the gender of the player is nihil:
   if the player's command includes "[gender]":
      now the gender of the player is the gender understood;
      if the gender of the player is nihil:
         say "This story requires a selection of male or female. [run paragraph on]";
         reject the player's command;
      if the gender of the player is masculine, now the player is male;
      if the gender of the player is feminine, now the player is female;
   now the command prompt is "What is your name?>";
      
To decide whether collecting names:
   if the command prompt is "What is your name? > ", 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 ">";
      move the player to The Chamber;
      reject the player's command;
      say "[banner text]";
      say "[line break] You wake up cold and disoriented...";
      reject the player's command.


Top
 Profile Send private message  
 
PostPosted: Sun Jun 17, 2012 8:43 pm 
Offline

Joined: Wed Jan 19, 2011 3:36 pm
Posts: 99
"reject the player's command" literally means "don't parse the player's command into an action". You should use it anywhere you want to prevent an action from being parsed, even if the input was perfectly valid.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 5:04 am 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 985
Location: Gothenburg, Sweden
You need to 'reject the player's command' at the end of the first 'after reading a command' rule.
The command prompts still don't match ("What is your name?>" vs. "What is your name? >).
And there is some logic affecting trouble with the indentation in the 'after reading a command' rules.

This, I think, is what you want (with changes in mere indentation marked by '[]' and other changes by '[!]'):
Code:
After reading a command when the gender of the player is nihil:
   if the player's command includes "[gender]":
      now the gender of the player is the gender understood;
   if the gender of the player is nihil: []
      say "This story requires a selection of male or female."; [!]
      reject the player's command; []
   if the gender of the player is masculine, now the player is male; []
   if the gender of the player is feminine, now the player is female; []
   say conditional paragraph break; [!]
   now the command prompt is "What is your name? >"; [!]
   reject the player's command. [!]
      
To decide whether collecting names:
   if the command prompt is "What is your name? >", yes; [!]
   no.
   
After reading a command when collecting names:
   if the number of words in the player's command is greater than 5:
      say "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 conditional paragraph break; [!]
[   reject the player's command; ] [!]
[   move the player to The Chamber;] [!]
   say "[banner text]"; []
   move the player to The Chamber; [!]
   say "[line break] You wake up cold and disoriented..."; []
   reject the player's command. []

_________________
Man ska inte tro allt man tänker.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group