Need help figuring out a few things in Inform 7.

Hello. So I’m trying to make a game in Inform 7. Both the manual examples and some of the syntax are confusing me. I hate to just spam a post with a bunch of questions, but that’s kinda where I’m at with things.

So the game I’ve come up with is about a hitman (the player) who knows his target is somewhere in a hotel, but he has to jump through some hoops to figure out how to reach him.

Here’s a bullet list of the things I’m struggling with:

  1. I have a brochure stand, which you should be able to take things from, but not put anything in. The text is supposed to say “The small slots are only suitable for holding brochures” basically. I can make a command to say "Instead of dropping something inside the brochure stand: say “you can’t”. But it still allows any object to be placed inside.

  2. I couldn’t figure out how to make a brochure (or book or w/e) have both a description and readable text. Like a water park brochure. Desc: “Water parks aren’t my thing.” Read: “Bring your family. Call 555-5555 for reservations”.

  3. The player has a cell phone that’s primary purpose is to type in a person’s name for a phone lookup service, and to call said numbers. The idea is to type “phone lookup Jim Smith” (or something similar), so long as your phone is possessed. Or “Call 555-5555”. I’m not 100% sure how to set that up. I’m also considering putting in superfluous things like Quote of the Day, or the news, etc.

  4. I am almost tempted to randomize certain things each new game, like what room the target is in, or the phone numbers. I realize I’m probably just getting waaaay ahead of myself here. I’m nothing if not ambitious.

  5. I want to have a hotel registry book with multiple pages, and you use a command “turn to/flip to/look at/read Page 1” etc. to read it. I found an example of something similar in the manual, but it confused me beyond all imagination. It seemed WAY too complicated for something like this.

  6. Is there a way to disable “take all”, or maybe just as well, make objects untakeable until the player sees them for the first time? Certain things are supposed to be found by first looking in their respective containers. I have made objects hidden, and indeed they are not displayed in the game window, but typing “take all” puts them right in my inventory, even from a container.

I could think of more, but this is already getting kind of big. I’ll just leave it at that for now. Thanks!

  1. It should be “Instead of inserting something into the brochure stand.” (A useful thing here is to start your game, type ‘actions’ at the command prompt, and see what it prints when you put the stuff into the stand – that tells you the name of the action you need to preempt.)

  2. To make a separate reading action you need to first make “read” not be a synonym for “examine,” which you do with the “Understand… as something new” phrase. Then define reading as an action, and make “read” work as reading:

[code]Understand the command “read” as something new.

Reading is an action applying to one thing. Understand “read [something]” as reading.[/code]

…and write rules for it.

  1. You could look at the documentation example “Four Cheeses” for some stuff about how to make a phone. It’s pretty complicated. Depends on exactly what you want to do.

  2. Cool! Some of these things will be more complicated than others.

  3. Eh, can’t think of a straightforward way to do this. Maybe just give it one page that responds to “read” if you want something not complicated first.

  4. Well, you can use the activity “Deciding whether all includes…” (see section 18.36) to exclude things from “take all.” I guess if you’ve got a property to make something hidden, you can write “Rule for deciding whether all includes a hidden thing: It does not.” Depends on exactly how you’ve implemented it. Another approach is just to start the objects out of play, and don’t move them to the containers until the player looks there.

To add on to Matt’s responses…

This will help with the reading action.

[code]Reading is an action applying to one visible thing and requiring light. Understand the command “read” as something new. Understand “read [something]” as reading.

A thing has some text called printing. Definition: a thing is printed rather than unprinted if it’s printing is not “”.

Check reading an unprinted thing: try examining the noun instead.

Carry out reading: say “[printing of the noun]”.[/code]

This is the simplest way I know to do your registry.

[code]Instead of consulting the Registry about a topic listed in the Table of Registry Entries:
say “[response entry][paragraph break]”.

Table of Registry Entries
topic response
“101” “Occupant: Mr. Smith”
“Smith” or “Mr. Smith” “Room 101”[/code]
The tabs don’t line up properly, but the editor should make it look right.

For your randomization, if you define regions you can use

When play begins: Now the target is in a random room in (a region).

Thanks much for the help! I’ve got a lot of the suggestions already working.

So if you don’t mind me carrying on with questions…

I’m considering the use of location searching. As in, if there’s a dresser, you can look under it (to find dust bunnies), on top of it (to find someone left a key there), or inside of it (to see clothes). It just makes the detectiving a little more thorough than having “examine” automatically spell out everything. I had a couple of ideas that weren’t working.

Also, when I consult a table, is there a way to repeat the topic’s name inside a “say” statement? Using [noun] just refers the thing being consulted.

Here’s some code re: hiding things under things and finding things under things.

[code]Underlying relates various things to one thing. The verb to underlie (he underlies, they underlie, he underlaid, it is underlaid, he is underlying) implies the underlying relation. The verb to be under implies the underlying relation. The verb to be beneath implies the underlying relation.

Instead of looking under a thing which is underlaid by something (called the lost object):
say “You find [the list of things which underlie the noun]!”;
now every thing which underlies the noun is carried by the player;
now every thing which underlies the noun does not underlie the noun.

Hiding it under is an action applying to one carried thing and one thing. Understand “put [something preferably held] under [something]” as hiding it under. Understand “hide [something preferably held] under [something]” as hiding it under. Understand the commands “shove” and “conceal” and “stick” as “hide”.

Check hiding it under:
if the second noun is not fixed in place, say “[The second noun] wouldn’t be a very effective place of concealment.” instead.

check hiding it under:
if the second noun is scenery, say “[The second noun] wouldn’t be a very effective place of concealment.” instead.

Carry out hiding it under:
remove the noun from play;
now the noun underlies the second noun;
say “You hide the [noun] under the [second noun].”[/code]

For your dresser, you could make it a supporter which incorporates a container (for the drawers). Examining the dresser looks on top, examining or searching a drawer looks inside, and “looking under” it with MTW’s code looks underneath.

IIRC Emily Short’s extension to automatically place multiple drawers and allow the player to refer to them elegantly works in 6L02, which makes this a bit easier.

For your second question, try the “topic understood”.

No. A topic might look like

"light bulb" or "light/bulb"

…which is not a suitable thing to print in a sentence, so Inform refuses. You’d have to add a text column to the table, giving the canonical printed form of the topic.

This is printable, but it repeats the exact words that the player typed, including spacing and capitalization. This may not fit your sentence.