[I7] Multiple "How do I...?" questions!

I figured I should make something as simple as possible (that would still be fun for the player) for my first IF game. Of course, that means I ended up with a plan for a potion-making system and a shape-shifting animal companion NPC. headdesk

Here’s stuff I can’t figure out how to do, so it would be swell if someone could point me in the right direction:

Make some extra text show up after the normal room description only on the first time you enter a room?

What’s the right way to make a door auto-open and display some text when you unlock it? This doesn’t work:

After unlocking the drawing room door: now the drawing room door is open; say "The key unlocks the door easily, and it opens to a dark stairwell."

If I want to make a rope ladder that you have to unroll to go to another room, should that be a locked door…?

I’m sure there will be more questions, but I’ll stick with this for now.

Thanks for the help.

First one:

The Stairwell is a room. "You've reached the stair[first time]. You pause for a moment to stare[only]."

Second one:

After unlocking the automatic door with the passcard: try opening the noun.

Third one:

Report opening the rope ladder: say "The ladder unrolls easily."; rule succeeds. Understand "unroll [something]" as opening.

Perfect, thanks!

Okay, here’s more…

Can I make something openable/closeable without making it a door or a container? I’m thinking things like windows.

How can I change/customize the “[NPC name] arrives from the [direction]” text that pops up when an NPC moves into the current room? I’m pretty sure this is used in the Patient Zero example game, but that’s a bit too advanced for me, so I’m having trouble picking out the part I need. (I only have one NPC.)

You can say

The window can be open or closed.

…and then define rules for “opening the window” and “closing the window”.

Or you could make the window a container, and then define rules to prevent the player from putting things in it. :slight_smile:

(Either way, don’t forget responses for “searching the window”, which is the action that results from LOOK THROUGH WINDOW.)

I think you can also say “the window is openable and closeable.” to make it respond to normal player action.

“The window is openable,” I think. (The “openable” property includes the ability to close it.)

Of course then you have to figure out what difference it makes when the window is open.

For the “NPC name arrives from the west” responses, look into customizing the describe room gone into rule responses. There are a bucket of special cases here, but the main case can probably be taken care of with this:

The describe room gone into rule response (F) is "Lauren slinks in from [the back way]".

(The back way is a local variable defined in that rule for the direction the actor just came from.) There are lots of other special cases for things like when the direction gone is up or down, when the actor is pushing something, when the actor is pushing something the player is on… you might look at the rule in the Standard Rules and figure out which ones you actually need.)

Oh, and an idea about this–I’m not sure exactly what you’re going to do with this, but if you write five funny messages for the NPC entering the room, and the NPC is going to enter a room that the player is in eighty times, then the player is going to see those messages sixteen times each. By which time they might not be as funny. Sometimes a way to do this would be to have the messages start out funny and ramp down toward more and more generic messages. (Not that I’ve ever managed to do this in one of my games.)

I get this when I try to just have “The kitchen window is openable.”

Section 3.7 of the manual just says rooms aren’t allowed to have the transparent/opaque property and that Inform makes assumptions about some unspecified properties based on kind.

The window can be open or closed.
The window can be openable. The window is openable.

Indeed, this allows the standard opening and closing actions to work.

Ohhh, I wasn’t understanding the “can be” syntax before. I think I got it now. It works! Thanks!

Here’s yet another: There’s a few spots where the player might be tempted to use in/out instead of a compass direction, so I wanted that command to work.

I tried these:

Check going outside while the location is the laboratory: try going north instead.

Instead of going outside while the location is the laboratory, try going north.

But both of them are giving me the “But you aren’t in anything at the moment.”

The ACTIONS debugging command shows…

You have to catch both “exiting” and “going outside”. Yes, this is more of a nuisance than it needs to be.

Thanks! Weirdly enough, going inside doesn’t have the same problem.

Another question:

I’ve got a container object (carrying capacity 1) that is intended to hold a specific other thing, but it’s conceivable that the player might put something else in there first. I figured it’d be convenient to automatically move the current contents to the player’s regular inventory if they try to stick the right thing in there, but what’s the syntax?

Instead of inserting the snow into the icy carafe: if the icy carafe contains something: ????; say "You use the carafe to scoop up some snow."; now the snow is in the icy carafe.

Untested, but this is probably easiest if it works–when you test for “if the icy carafe contains something” you can assign the thing it contains to a temporary variable.

[code]Instead of inserting the snow into the icy carafe:
if the icy carafe contains something (called the contained thing):
say “(first taking [the contained thing] out of the carafe)”;
now the player carries the contained thing;
say “You use the carafe to scoop up some snow.”;
now the snow is in the icy carafe.

Instead of inserting the snow into the icy carafe when the snow is in the icy carafe:
say “The carafe is already full of snow.”[/code]

…but that last case might be tricky, because you don’t want a situation where the player types “PUT SNOW IN CARAFE” and winds up implicitly taking the snow before the rule can stop it. If that happens you might need to stop the action earlier, perhaps in a Before rule–I haven’t checked it yet.

(Oh, and the reason that going in doesn’t have the same problem is that the command “OUT” serves a double function that “IN” doesn’t. “OUT” can be exiting, the action you perform to get out of a container that you’re in, as well as going outside, the action you use to get from one room to a room that’s in the “outside” direction on the map. “IN” is only for going inside–if you want to enter a container you have to type something like “ENTER BOX,” because if you just typed “IN” Inform wouldn’t know what you wanted to enter.)

This might not be an issue in your game so far, but, in general, you’d want to check here to ensure that whatever you’re automatically moving to the player’s inventory can be held reasonably without a container. Otherwise, the player might wind up with some “loose” liquids in inventory.

There’s also the issue of multiple objects in the container; this only removes the first one. Usually the carrying capacity would prevent that. But if you have a lot of “move X to Y” in your code it can be bypassed.

Check inserting something into the carafe when the noun is not whiskey:
(TAB)say “Your OCD prevents you from putting anything but whiskey in the carafe.” instead.