Newbie rulebook question

Newbie here. Helping dd with a simple game she is designing.

The player is collecting ingredients from the pantry and putting them on the counter in the next room, the Kitchen. I want to avoid this sort of message:

[size=85]>e

Pantry
Inside the walk-in pantry are numerous dry goods labeled and stacked on shelves.

You can see a bag of flour, a container of baking soda, and a box of sugar here.

take sugar
you can put the box of sugar on the counter if it’s heavy.

put sugar on counter
You can’t see any such thing.
[/size]

I tried using this, but I still get the error message:

Instead of putting anything on counter when player is in Pantry:
now player is in Kitchen;
now noun is on counter;
now player is in Pantry.

Thank you!

So just to make sure: the walk-in pantry is implemented as a room connected to the kitchen, and you want the game to assume the player wants to go back into the kitchen when they try to set something on the counter (since the counter is actually in the kitchen).

I believe you want to handle this as a two-parter. First, you need to put the counter “in scope” from the pantry, which means that you can see it from there (otherwise, Inform assumes rooms are basically opaque boxes, which is why you’re getting the “can’t see any such thing” message). You can learn about scope in chapter 17.27, and here’s the gist of what you’ll want to do:After deciding the scope of the player when the player is in the Pantry: [tab]place the counter in scope.

Second, you want to tell the game to let the player try going back to the kitchen before dropping something on the counter. It’s nicest to do this with a “try [action]” phrase, because if the player can’t go back to the kitchen for some other reason (pantry monsters have glued her feet to the floor, maybe?), your rule won’t artificially override that. So you can do that like this:Before putting anything on the counter when player is in Pantry: [tab]try going to the Kitchen; [tab]continue the action.You may also be interested in “try silently,” in chapter 7.4.

If I’ve misread the situation and the intent is that there’s a counter that’s reachable from the pantry (as in, it’s within arm’s reach), you should check out chapter 12.16, on reaching inside and reaching outside rules.

Okay. First off, when it comes to writing in Inform 7, indentation matters. If you want to post your source code and want to preserve the tab spaces, use code tags, like this:

[code]

The Office is a room. [/code]

Next, your question doesn’t seem to have much to do with rulebooks. I can’t tell what you’ve written in the code so far, but I can guess. Did you remember to define the counter as a supporter? And is the counter in the same room?

Bingo. I just finished Aaron Reed’s book and he also describes scope on p.329-330, but there’s so much Inform stuff to absorb.

Eleas: Sorry, the tab’s disappeared when I copy/pasted into the editor. I’ll mark them in next time.

Thanks for your quick reply!

Oh, absolutely. The only way a lot of us know the answers to intermediate-level questions like these is that we’ve been there before ourselves. (I myself wrote a game that was a total nightmare when it came to getting scope issues right…)

Sorry, I didn’t mean to imply you made a mistake. By enclosing your code in the [code] tags, you can show the code on the forum and it will look exactly like it did when you wrote it. Otherwise, the forum won’t show the tabs.

So in short, easiest way to show your own code on the forum is to highlight it in the Inform 7 editor, paste it into your post, and enclose it in [code] tags.

This is the second time recently that a question has reminded me of Shade. I think the last one was about hiding objects in random places. The source code for Shade is available, but it’s in I6 so it’s probably not that useful. But in this case, just playing the game can give you a nice idea of the way “fake” rooms are handled. My guess is that the closest I7 equivalent would be to make all the connected rooms into enterable containers. But it could also be done with a “position in the room” variable or scene.

I think the easiest way would be to build on the Rock Garden example. You may need to change the way it reports inter-room movement and print the room name differently, but the core of what you need is already there. Of course, it would depend; if you want to make certain rooms invisible but possible to reach, then you should probably modify the “After looking when the location is an inter-visible room:” rule.