Dipping into Inform 7, some questions

So I’m trying to dabble with using Inform 7, and I have some questions. I started off with the complimentary peanuts example in the documentation, trying to explore conversation. The code I’ve written is below. I tried adding in the ability to ask quesitons (and make statements" of characters (eg, “Mr Green, Who is Professor Plum?”, “green, Where is Plum?”, “green, Where was plum at 3:30pm?”, “green, where was the murder”, “green, when was the murder?”, “green, plum was in the study at 2pm”).

I have some of it working to a certain degree. I look up in a table to try to determine what kind of question it is, which sends me to another table, where I can narrow down the question and return an answer.

  1. How can I refer to rooms? eg, “Where is the study?”

  2. Some weirdness comes into referring to people. I’m not sure if it’s because the person is not visible, but I can refer to Mr Plum, but not Plum or Professor Plum (I can refer to green or Mr Green, who is in the room)

eg, “Green, who is Plum” does not work, but “Green, who is Mr Plum” does.

  1. My questions seem to work as long as I don’t have a question mark in it.

eg, “green, where is green” works, but not “green, where is green?”. Changing the table so it has “Where is [person]?” doesn’t fix this.

  1. I wan’t to be able to create events, where an event has a start time, an end time, a location and maybe a description. How do I do this?

This is so that I can make the game understand “Wherewas the [event]” or “When was the [event]”

eg, “Green, where was the party” (The party was in the ball room), “Green, when was the murder” (The murder was between 5pm and 6pm).

  1. Is there any way to get it understand multiple tokens in a table?

eg. “Where was [person] at [time]” “Plum was in [room] at [time]”

  1. How do I modify time, apart from “to the nearest 10 minutes” eg, say I have a time, say 4:20 pm, and I want to set one time to 4pm and another time to 5pm.

  2. I’m trying to copy information from one table to another while modifying it at the same time, but having problems with it. I save the information (in this case, the roomname entry) as locationOfPlum, and I want to add “I heard he was in the [locationOfPlum]”) but I get an error message that it was expecting locationOfPlum to be something to say and it isn’t. This even though I’m able to use it to say something on the next line.

Thanks in advance.


The Library is a room. “A room full of books, with some chairs and a desk.”
The study is a room.

Mr Green is a man in the Library. Professor Plum is a man in the study. Professor plum is a person. Understand “plum” as professor plum. Understand “Mr Plum” as Professor plum. A book is in the library. A chair is in the library. A desk is in the library. A box is in the study. boddy is a person in the study.
Asking someone about something is speech.
Telling someone about something is speech.
Answering someone that something is speech.
Asking someone for something is speech.

Table 1 - Type of Question
topic numnouns tabname commentary
“Hello” 0 Table 2 “‘Why, hello there’”
“Who is [person]” 1 Table 2 – [2 refering to Mr Plum works, but not professor plum or plum]
“Where is [room]” 1 Table 4 – [1 why does this not work ?]
“Where was [person]” 1 Table 5 –
“Where is [person]” 1 Table 6 –
“Where is [thing]” 1 Table 4 –
“Where were you at [time]” 10 Table 10 “test succeeds”
“Where was plum at [time]” 10 Table 11 “test succeeds” [5 I’d prefer to have “Where was [person] at [time]”, but that doesn’t work]

Table 2 - subjects
topic commentary
“green” “‘That’s me!’”
“plum” “‘He’s an absent minded professor’”

Table 4
topic commentary
“library” “‘Why, this is the library’”
“the study” “‘The study is to the east’”

Table 5
topic commentary
“green” “‘I was right here’”
“plum” “‘I’m not entirely sure’”

Table 6
topic commentary
“green” “‘I’m right here’”

Table 10
timestart timeend commentary
3 pm 4 pm “‘I was reading in the study’”
4 pm 6 pm “‘I was playing pool in the billiards room. Or is it billiards in the pool room?’”

Table 11
timestart timeend commentary
4 pm 6 pm “‘He was playing pool with me in the billiards room’”
with 20 blank rows

Table 100 - statements
topic tabletochange roomname
“plum was in the study at [time]” Table 11 “study”
“plum was in the billiards room at [time]” Table 11 “billiards room”
“plum was in the lounge at [time]” Table 11 “lounge”

The tablelookup is a table-name that varies. The tablelookup is Table 1.

Instead of speech when the noun is Mr Green:
repeat through Table 1:
if the topic understood includes topic entry:
if numnouns entry is 0:
say “[commentary entry]”;
rule succeeds;
if numnouns entry is 1:
Change the tablelookup to tabname entry;
repeat through tablelookup:
if the topic understood includes topic entry:
say “[commentary entry][paragraph break]”;
rule succeeds;
if numnouns entry is 10:
Change the tablelookup to tabname entry;
repeat through tablelookup:
if the time understood is after timestart entry and the time understood is before timeend entry:
say “[commentary entry][paragraph break]”;
rule succeeds;
if the time understood is the timestart entry:
say “[commentary entry][paragraph break]”;
rule succeeds;
say “‘I don’t know’”;
rule succeeds;
repeat through Table 100:
if the topic understood includes topic entry:
let locationofPlum be the roomname entry;
change tablelookup to tabletochange entry;
choose a blank row in tablelookup;
change timestart entry to time understood; [ 6 I want to set this to the start of the current hour]
change timeend entry to time understood; [ 6 I want to set this to the end of the current hour]
change commentary entry to locationofPlum; [ 7 Why can’t I change this to “I heard he was at the [locationofPlum] at that time”?]
say “‘Oh, he was in the [locationofPlum]?’”; [ 7 Why does this work? ]
rule succeeds;
say “‘Hmmf,’ says Mr Green.”;

I’m fairly new to Inform too, so I can’t help you for most of your questions.

For the events however (question 4), it looks like you’ll have to create a new kind. Typing this from the top of my head (you’ll probably have to do some additional stuff to get it to work the way you want to, though hopefully what i’m about to type will be enough to get the cogs turning):

A Happening is a kind of thing.
A Happening has a Location value.
A Happening can be dull, fun or shocking (this is the description property).

The Party is a Happening. Its Location is The Ballroom. It is fun.
The Murder is a Happening. Its Location is The Study. It is shocking.[/code]

Then when you want to refer to it, you use “Where was [happening]?”. If the NPC isn’t important, and you don’t want to waste time typing out a unique response for every event, you can then say “Oh, [the noun]! [description of the item described] wasn’t it? That took place in [location of the item described].”, which can then generate either “Oh, the party! Fun wasn’t it? That took place in The Ballroom.” or “Oh, the murder! Shocking wasn’t it? That took place in The Study.”

Once you get comfortable with this, you could then even extend the Happening kind to include a time and date, allowing you to ask WHEN the Happening took place.

Hope this helps.

EDIT: Oh, and one more thing. You’ll probably want to make sure it’s impossible for the player to ask about a certain event before it’s happened.
For this, we add to the above code:

A Happening can be unrecorded, planned or recorded (this is the record property).

By placing “unrecorded” first on the list, all Happenings will be unrecorded by default. It’s then just a matter of using the necessary checks to change the response based on the record property.

If the party is unrecorded, Green could say: “Party? What are you blathering on about?”
If it’s planned, Green could say: “Oh, the Party? That’ll be in the Ballroom as soon as Peacock gets her act together.”
And finally, if it’s recorded, Green could say: “Oh, the Party? That took place in the Ballroom. I don’t blame you for forgetting, frightfully dull wasn’t it?”

And then all you need to do to change the status would be to say:

now The Party is planned.

During an event, and the record property we set will change.

So to recap, The Party (like all Happenings) start off “unrecorded” by default (due to it being first in the list). It hasn’t happened yet.
In a later dialogue one of the characters suggests an impromptu party in The Ballroom. Now The Party is planned.
Later on (once Mrs.Peacock has gotten her act together, lol) the party happens. Now The Party is recorded.

So yes, this should stop the player from being able to ask about a Happening before it, well, happens. :stuck_out_tongue:

Good lord what a handful. I’m terrible at explaining things so I hope you got something from this.

This was helpful.

Turns out, you can’t call it a happening, presumably because it is a keyword. Also, the event has to be in the room the player and green are in to be referred to.

So this almost works:

An event is a kind of thing.
An event has a text called event location. 
An event has a time called beginning time.  An event has a time called end time.
An event can be dull, fun or shocking.

The Party is an event. It has an event location "The Ballroom". It is fun.  It has a beginning time 8 pm.  It has an end time 11 pm.
The Murder is an event.  It has an event location "The Study". It is shocking.  It has a beginning time 1 am.  It has an end time 2 am.

The Party is in the library.
The Murder is in the library.

"where was the [event]" 20 -- "'Oh, [the noun]! It was in [event location of the noun].'" "when was the [event]" 20 -- "'Oh, [the noun]! It was from [beginning time of the noun] to [end time of the noun].'"

Except that the events are physical objects in the actual library.

And you’re right, I hadn’t considered that one should take into account the before and after (and during) of an event.

Turns out that this ties in with the above issue. Apparently it thinks the Mr in Mr Plum is Mr Green, but gives me the response for plum cause plum is in the question.

First of all, the problem of the events being actual physical objects.

Instead of “a kind of thing”, try “a kind of backdrop”, and then tell it that “an event is everywhere”. Backdrops aren’t items so they can’t be picked up (you’d usually use backdrops for things such as a moon that you can see in every outdoor room), and they can be placed everywhere without problem (though i’m not sure of the exact wording you use).

As for the characters thing, try setting them up like this.

A man called Green is here.
Understand “Mr Green” or “Mr.Green” as Green.

A man called Plum is here.
Understand “Mr Plum” or “Mr.Plum” as Plum.

Now the player can type “Mr Plum” and it’ll automatically be seen as Plum, and “Mr Green” as Green.

You’ll probably need to do something about the periods in titles, as well. Otherwise, it breaks the command into two at the period.

OK, this works. Thanks. (I had to make the descriptive text not a description, so the player couldn’t examine the event.)

Unfortunately, that’s not the problem. The problem is that I want Plum to be in a different location then green.

If I’m understanding you right, you want to make it so that the player can’t “x [an event]” or “take [an event]”, etc. If this is the case, just use the following code: Instead of doing anything to an event: say "You can't see any such thing."

Do you mean you want to refer to, say, Plum when he’s not in the room? Then you may need to change the scoping activity for the player. Look up deciding the scope of the player in the activities section of the docs. However you may be able to get around this by not rolling your own conversation code – look at Eric Eve’s conversation extensions, particularly Conversation Framework I think.

Actually, I think he means just having them in different rooms from each other, so the “events-as-physical-objects” approach wouldn’t work (though using a backdrop fixes this nicely).

Backdrops does work for events, and increasing scope does work (to some extent) for people (and other objects), though I’m trying to figure out how to prevent the player from interacting with objects not in the same location as the player (except when asking questions).

After deciding the scope of the player:
	place the location of the player in scope;
	repeat with outside stuff running through things: 
		unless the outside stuff is in the location, place the outside stuff in scope;
		[instead of doing anything to outside stuff, say "You can't see any such thing.";]
	repeat with other place running through rooms: 
		unless the other place is the location, place the other place in scope;

It also has the benefit of addressing my first question, since all rooms, including the one the player is in, are now in scope.

Putting in the “instead of” line gives me the error message that it doesn’t recognize it, even though it works for events.

George’s advice on this point was good: check out Eric Eve’s conversation system, which extends the very minimal system built into Inform. You don’t necessarily have to use his extensions (though I’d recommend you at least give them some time to see how useful they’d be), but you can definitely learn something from them.

Like how to solve this scoping issue, for example. If you first tell Inform what “known” means (from Eric’s Epistemology extension):

[code]A thing can be familiar or unfamiliar. A thing is usually unfamiliar.

Carry out examining something visible (this is the mark items as seen on examining rule):
now the noun is familiar;
now the noun is seen.

Definition: a thing is known if it is familiar or it is seen.

Definition: a thing is unknown if it is not known.

An event is familiar. [/code]

…then you don’t need to have the events in the same room as the player any more (you can just create the even objects off-stage). This kind of grammar is really all you need to talk about things that are not in the room (from Conversation Framework):

Quizzing it about is an action applying to two visible things. Understand "ask [someone] about [any known thing]" as quizzing it about.

In the “any known thing” token, the “any” tells Inform that the grammar should match any object in the game, regardless of where it is–this happens separately from any scoping rules you might write (so you also don’t need to mess with scoping rules when you do it this way). Meanwhile, the “known” allows the player to refer only to objects that he already knows about (either he’s seen them in the course of the game, or the author has previously marked them as “familiar”). So now the player can in principle refer to anything in the game, but we restrict that by using the adjective “known”.

(Note: the any known thing token will not work unless the grammar has been defined as referring to visible things. “Visible” really means “in scope”, and the “any” token will place all known things in scope–they thus become “visible” in this sense, even though the player can’t actually see them. It’s a bit confusing…)


That conversational system works for “ask green about plum” or “tell green about plum”, but AFAICT it doesn’t work in the form of “green, [something]” like “green, where is plum”

As a side issue, if I try to get it to understand “green, tell me about [person]” (as an alternative to "who is [person]) or “green, describe the [event]” (instead of “how was the [event]”) they don’t work. I’m guessing this is because Inform thinks I’m commanding Green to do something rather than asking - where is this action defined in inform?

Funnily enough, “green, describe [person]” works.

“tell me about [person]” doesn’t work because of the “telling it about” action - It thinks you’re asking Green to tell the player-character (who can be referred to as “me”, in constructs such as “x me”) about some text. Try this: Understand the command "tell" as something new.

You’ll need to write new grammar for most or all of the new commands you want to create; things like “Green, where is Plum?” are used in very, very few games. I don’t think anyone has written an extension to allow for the family of “who, what, when, where” questions. (These are very tied into the mechanics of the game itself in any case, so it’s unlikely that a single approach would satisfy all or even most applications.)

See the Standard Rules extension (automatically included into every game created with the I7 IDE); that’s where all of the conversation grammar that comes baked into Inform is defined.


Expanding ektemple’s “Quizzing it about” idea, you can expand the ‘Understand’ method to include things like “[someone], where is [any known thing]?”. Then you can use an instead method.

Instead of Quizzing Green about The Party: try silently asking Green about The Party.

I know there’s a way to expand this to make it more general (something along the lines off “try silently asking Green about [the noun]” or something like that), but for now that’s the general idea.