Assorted Inform 7 questions

I am working on an Inform 7 game. I don’t want to start too many threads so I thought I would make a general one. I’m making good headway with the documentation but having trouble with a few things.

The uniform is a wearable object. The park ranger is wearing the uniform.

When playing, I try and take the uniform from the park ranger, it tells me “That seems to belong to the park ranger.”

Is there any built-in way to make it so that I can take the uniform? “The uniform is takeable” does not seem to work.


If you enter RULES to turn on rules tracing before your attempt to take the uniform you’ll see…

[Rule "can't take people's possessions rule" applies.]
That seems to belong to the park ranger.

That’s a check taking rule in the Standard Rules. There are a lot of ways one could modify the rules to allow this, but here’s a super-simple and super-narrow (i.e., not likely to affect other situations) one: The can't take people's possessions rule does nothing when the noun is the uniform and the holder of the noun is the park ranger.


That works, thanks. Looks like it works with natural language too:

The can’t take people’s possessions rule does nothing when the park ranger has the uniform.

1 Like

when the park ranger has the uniform will also let the player take things away from anyone else in the game up until the player takes the uniform. Maybe the park ranger is the only person in the game and the uniform is the only thing the ranger will ever have and that’s fine.

1 Like

Haha, I thought there would be something like that. Now that I read what I wrote I can see it that way.

1 Like

Another problem I am having is with the “understand” function. I have managed to get it working with square bracketed “somethings,” but is there a way to use it with particular objects? Like this:

Understand “opening the car door” as opening the car.

In this case, the car is a container in a room, and the car door isn’t an actual object in the game.

1 Like

When you use an understand statement for an action, it needs to include an indication for where the object of the action will go, and you can’t dictate what the object will be, so yeah, that won’t work. Easiest thing would probably just be to have “car door” be a synonym for the car - if you’re concerned this would lead to potentially weird behavior (like, if the player tries to DRIVE CAR DOOR) you can always just implement a placeholder object.

That works for my purposes.

Is there markup for annotating the script (that is, writing text that doesn’t actually do anything in the game)? I googled it and looked in the doc index but nothing is showing up.

Outside of quotation marks, square bracketed text [like this] is not read or compiled by inform. You can use it to comment your source. The comment can take up multiple lines, and only ends with a close square bracket.

EDIT: It’s covered here in Writing with Inform.

1 Like

Thank you!

I am trying to work out how repeated actions interact with before/stop actions and instead of actions.

As that page notes, “we are counting the number of times the action has been tried, not the number of times it succeeded.” Is there a way to count the number of successes?

Instead of photographing: if the player does not have the camera, say "You can’t take pictures without a camera.

After photographing the map for the first time: if the player has the camera, say “This photo will help you navigate the park with ease. You add it to the load that you are carrying.”

Basically, the goal is to make the latter response happen only on the first successful photographing action by the player. As it is right now, an unsuccessful photographing action will prevent the latter response from appearing on the first success.

I have been playing around with success rules but it seems to make no difference.

Am I using “if” incorrectly? Does the “while” clause apply here?

There can’t be too many topics :slight_smile: This forum is a great place to search for answers, and non-general topic titles are helpful for that. Enjoy Inform 7!

1 Like

You’ve almost got this right - the issues is that you don’t have the conditional in the header if your instead rule, but in the body. So the instead rule always fires, printing the unsuccessful attempt text if the player doesn’t have the camera and doing nothing if they do - but in either case, the instead rule is preempting the action so it never successfully completes.

If you change the rule to:

instead of photographing while the player does not have the camera: 
          say "You can’t take pictures without a camera.”

It should work as intended.

For the second part, I’d be inclined to tie it to the photo object, assuming that you’re implementing that.

The photo is a thing. It is nowhere.     [The second sentence here isn't actually necessary.]
After photographing the map when the photo is off-stage:
        now the player holds the photo;
        say "This photo will help you navigate the park with ease. "

The After rule will only fire once (when the player succeeds in photographing the map), provided you don’t remove the photo from play again later.

If you do find yourself having to track the number of successful attempts at some action, the easiest way is almost certainly to set up your own counter.

I ended up doing something like @jrb 's suggestion with extra steps. In addition to moving photos out of nowhere when they are photographed, the photos are now members of a kind called “keepsakes” that are automatically picked up and can’t be dropped.

The “first time” event is triggered by picking up the photo, which is guaranteed to happen on the first try…I hope.

@DeusIrae I will come back to that later.

Oddly enough I’m seeing that the Inform 7 documentation uses photographs in several examples. I guess this is something that a lot of people including myself want to do in text adventures for some reason.

I remember Robin and Orchid from IFComp a few years back had photography too…wow, that was almost ten years ago.

Thanks to everyone’s help I now have a fully functional parking lot with a car. Off to bed for me…

1 Like

You may want to edit your post to add the missing ‘NOT’ before 'helpful" as in its current form, It makes no sense. shouldn’t it be - non-general topic titles are NOT helpful for that :slightly_smiling_face:

1 Like

I got the intended meaning.

1 Like

I’ve now tried your solution @DeusIrae, that is much more straightforward though I still don’t quite understand the syntax.

I’m now trying to create a sitting and standing system. Following the documentation I successfully overrode the default standing action with:

Understand the command “stand” as something new. Standing up is an action applying to nothing. Understand “stand up” and “stand” as standing up.

However, I also want to add “get up” to that list of synonyms. I can’t override the built-in “getting up” command because understand as something new only accepts single words.

I’ve also tried writing:

Instead of getting up, try standing up.

The actions index shows:

“get out/off/down/up” - Exiting
“get up” - Standing up