List of People in Room- only if people are in Room

I have turned on brief room descriptions, but I still want to show a list of people in the room the player is in. I have been attempting something like this:

If people are in Side Yard: say "You see [List of people in room] here." 

But I keep getting an error message. I don’t want it to say “You see here.” when nobody is in the room, but I’m having trouble with creating this rule.

I think what you’re looking for are Writing a Paragraph About rules – see documentation here.

That syntax looks weird to me, though. Is that If statement attached to anything else? Similar to the issues with scenes in your other threads, you can’t just have random logic statements floating around in your code in Inform – they need to be included in a rule of some kind. When I was getting started with Inform I found looking at the source code for some completed games was super helpful for just seeing how these pieces fit together. IFDB has a list of games with recent-ish Inform 7 source code available, and it might be worth digging into a couple.

I hope I’m not being a nuisance. I’m really trying to understand this program. I’ve been digging through the material you recommended. I realized I needed to name the rule, so I made this following- which gives me no error message:

This is the list people rule: 
	If room contains people,
	 say "You see [list of people in room] here."

The issue is, I think this is being overruled by another rule. Probably:

Use brief room descriptions.

But I’m not sure. Either way, it’s not printing “You see x, y, and z person here” as is my intention.

No worries, talking about Inform is helping me manage excess energy on Election Day :slight_smile:

I think the issue you’re having is that the rule is never being invoked – you need some piece of logic that tells the program when to call it. For a rule you create yourself, you need to tell the program when to execute it, like in an Every Turn rule or a scene change rule or a Before… or After… rule.

The “rule for writing a paragraph about” stuff doesn’t need to be specifically invoked because that’s part of the existing framework of rules Inform consults when it updates the description of the location when the player moves or a turn passes – I’m not an expert on how BRIEF works but I believe that just suppresses the room description, not the objects and NPCs in it.

1 Like

I suspect that your list of people must be explicitly included in the brief output rule. How is done, I dunno. (I wait the fallout after next I7 release prior of assessing if I7 can be considered production-grade (being extremely slow in development…) )

Best regards from Italy,
dott. Piergiorgio.

I decided to look into this for fun, and are you sure the default behavior of Inform 7 doesn’t already cover what you’re trying to accomplish?

Subway is a room.  "This dark, dingy subway is both dark and dingy."
John, Sally, and Suzie are people in Subway.

The Tracks are west from Subway.

Test me with "brief / w / e".

I get all of the people listed in Subway even in brief mode.

1 Like

Your problem is that your list people rule is not currently in any rulebook, so it never runs.

But there is a more general problem here, about the “use brief room descriptions” declaration. This doesn’t actually restrict the game to brief descriptions, it merely makes that the default. The player has control over this, and can override your default easily by typing VERBOSE or SUPERBRIEF. You probably want to make sure that your rule (however you end up running it) only runs if the game is in brief (maybe also superbrief) mode.

How to do that isn’t obvious, but Writing with Inform 27.22 tells us how to go about it.

Room description style is a kind of value. The room description styles are Brief, Verbose and Superbrief.
The current room description style is a room description style that varies.
The current room description style variable translates into I6 as "lookmode".

Now we can test the current style, e.g. “if the current room description style is Brief:”, etc.

1 Like

I don’t get this list. I’m not sure why

Thank you for your reply. If I do this, does it mean I will need to add some code when I create a room? As in “Use VERBOSE room descriptions when player is in Bedroom” ?

No, you can’t do anything like that. You could change the setting on entering a room (via a different method), but that’s entirely contrary to the point of the setting, which is to be under user control and remain fixed unless they explicitly change it themselves.

(As an author, if you want a particular room to never have a long description, you could simply not give it one.)

In most cases, you should just pretend that the brief description mode is not a thing that exists – most players expect long descriptions and will be annoyed if they’re not enabled.

As UncleSporky said, even in the brief description mode, Inform will display the names of people (or other objects) that are in the room without needing to do anything special. Are you sure that they’re actually in that room and not somewhere else? You can look at the Index -> World tab to see the world and everything in it at the start of the story.

I think at this point it might be worthwhile stepping back for a moment, starting a new Inform project, and putting the minimal amount of code in it that demonstrates the problem you’re having. Then you can post that full code along with how you’d prefer that it behave again, and we could give more specific advice.

1 Like

I don’t get this list. I’m not sure why

That’s odd. It’s possible you have some other code or rule that is changing whether people are mentioned. What if you create a new test project where the only code is the code I posted?

Here is the output I get:

This dark, dingy subway is both dark and dingy.

You can see John, Sally and Suzie here.

>test me

>[1] brief
Test is now in its "brief" printing mode, which gives long descriptions of places never before visited and short descriptions otherwise.

>[2] w


>[3] e

You can see John, Sally and Suzie here.