Conversation using command prompt

Hello,

I’ve recently started learning Inform 7. I did a bit of stuff many years ago in Inform 6, but this format is pretty new to me. I’m not by any means a programmer, so none of this stuff is obvious to me.

I’m trying to make this story, which starts with a simple conversation. I’m trying to use the command prompt, and give the player only a few options to type. ‘Yes’, ‘no’, and anything else. The character (Dr. Klein), will ask his patient (the player) a few questions, and have a limited set of replies.

This means that the player will not be using any standard commands like “ask Dr. Klein” or “talk to Dr. Klein”, but will simply type the reply directly into the prompt, and Inform shouldn’t be doing anything else other than typing Dr. Klein’s responses.

The whole thing is basically just to set up the atmosphere in what will - hopefully - be a thriller/horror game taking place in a psychiatric ward.

Here’s how I’m trying to set it up:

[code]Section 1 - Returning

Reply is a kind of value. The replies are neut, nowt, yes and no.

Klein is a man. Klein has a reply. Klein is neut.

Welcoming is a scene. Welcoming begins when play begins.

When play begins:
if Welcoming is happening:
talk to Klein.

After reading a command:
if Klein is neut:
if player’s command matches “no”:
now Klein is no;
if player’s command matches “yes”:
now Klein is yes;
otherwise:
now Klein is nowt.

To talk to Klein:
if Klein is neut:
say “[bold type]Dr. Klein:[roman type] So glad to see you back at the fold, Raphael. We’ve been missing you.”;
now command prompt is “Are you glad to be back? >”;
if Klein is no:
say “[bold type]Dr. Klein:[roman type] Oh well. You’ve had quite a set-back Raphael, and you need to be with the flock again”;
now command prompt is “Are you feeling numb in any of your limbs? >”;
if Klein is yes:
say “[bold type]Dr. Klein:[roman type] So glad to hear. We’re very happy to have you back in the pack, Raphael.”;
now command prompt is “Are you feeling numb in any of your limbs? >”;
otherwise:
"[bold type]Dr. Klein:[roman type] I’m sorry, I’m not sure what you’re talking about Raphael. Maybe we need to get on with the
now command prompt is “Are you feeling numb in any of your limbs?”.[/code]

This doesn’t really seem to work though, so I’m wondering if anyone could give me some tips?

I also quickly discovered that although I can get Inform to print the text, it will still print the “This is not a rhetorical question” message. Was wondering how I get rid of this?

Cheerio!

1 Like

Inform 7 has a built in function “if the player consents” for yes/no:

"Teatime"

Parlour is a room.

A teacup is a container.  a cube of sugar is a thing. 

When play begins:
	say "The butler proffers a tray.  'Tea, Moniseur?";
	if the player consents:
		now the player carries teacup;
		say "You are presented with a delicate cup of tea.";
	otherwise:
		say "Very good, Sir,' the Butler says, clacking his heels and leaving the room.";
		rule succeeds;
	say "'Do you take sugar, Moniseur?' the Butler asks.";
	if the player consents:
		say "'Very good, Sir,' the Butler says, dropping a lump into your tea.  He then turns and clacks away officiously to the drawing room.";
		now cube of sugar is in teacup;
	otherwise:
		say "'Ah, watching your figure, very good, Sir,' says the Butler, flouncing toward the Conservatory with the sugar bowl."
1 Like

I’m slapping myself a bit, cos I knew it was gonna be a really simple rule, and I was just making it way to complicated…

Cheers mate! If I could, I’d make a cup of tea for you :wink:

-Loui

Is there any way giving a response if there answer is not yes or no?

“If the player consents” will only accept yes or no (or y or n).

If you want to get slightly more complicated, you might want to look at the extension “Hybrid Choices” by AW Freyr. It allows you to drop into “cyoa” mode from the parser and present the player with a numbered list of choices they can pick from.

The only other thing I can imagine is if you make your non yes/no answers a command unto themselves.

"Interrogation"

Interrogation Room is a room.  "A bright light shines in your eyes.  You can see you're not getting out of here without providing some answers."

The block saying yes rule is not listed in any rulebook.
The block saying no rule is not listed in any rulebook.
[These are what was printing the "That was a rhetorical question" error message.]

Report saying yes:
	say "You feel quite agreeable."
	
Report saying no:
	say "You are being rather negative."

stradivariusing is an action applying to nothing.  Understand "stradivarius" as stradivariusing.

report stradivariusing:
	say "'Stradivarius!' you call out, for no particular reason."
	
Yourself can be under duress.  Yourself is under duress.

Waiting Room is a room.  "Well, you gave up the info.  Was that a good idea?"

A burly investigator is a man in Interrogation room.  "The investigator looks like he means business.  'Are you going to tell me what the murder weapon was?  We found rare wood bits at the scene and need to know if the violin in question was the rare and priceless STRADIVARIUS or not??' he growls. 'Come on, just say the word and you can go.'"

Instead of doing anything except looking, examining, saying yes, saying no, or stradivariusing when the player is under duress, say "It looks like the interrogator both wants an answer and could pound you into a greasy paste if he feels like it.  You'd better come up with something."

After saying no when yourself is under duress:
	say "[one of]The investigator takes out a plastic squeaky hammer and thonks you on the head with it: SQUEEK!  You've never heard such an annoying sound.  'There's a lot more where that came from if you don't cooperate,' he snarls menacingly.[or]Thonk.  SQUEEK!  You don't know how much more of this you can take.[stopping]"
	
After saying yes when yourself is under duress:
	say "[one of]'Yes!  Yes!' You holler, breaking down dramatically.  'I'll tell you anything you want!'[paragraph break]'All right then,' the interrogator says. 'You've got to say the word, was the violin in question a STRADIVARIUS?'[or]'Go on, tell me what the murder weapon was and you can go.'[stopping]"

After stradivariusing when yourself is under duress:
	say "'All right then, we got what we need to know,' says the interrogator, quickly hustling you through a door.  And as quick as that, he's done with you.";
	now the player is not under duress;
	now the player is in Waiting Room.

2 Likes

Also - the way I figured out what rule to unlist to make “yes” and “no” into usable commands was to run the game and type ACTIONS, then try the actions. This will have inform list what it’s running into.

actions
Actions listing on.

yes
[saying yes]
That was a rhetorical question.
[saying yes - failed the block saying yes rule]

Then because those actions were blocked, after unlisting them I had to provide report rules in case the player types them anywhere besides when I wanted them to. Otherwise it just shows a blank line when the player types YES because the rule previously was blocked and didn’t need them.