Inform 7 listing objects in room with newlines

Hey. I’ve scoured the docs for an hour, and tried to find the info via Google (and here as well, but it won’t let me search).

So, I’m trying to list the objects in a room with newlines. Going for something that looks like a listing of files, vs a listing of objects.

I’ve tried a number of Rules (Rule for listing nondescript items, etc.) but for some reason I cannot add newlines at all.


Rule for listing nondescript items: say "[(list of files in location)]".

Works fine. But if I add “with newlines” anywhere at all I get an error. I can’t use commas in a substitution either, which the newlines command seems to need.

Am I going at this in the wrong way?

Thanks in advance!

This is tricky because Inform’s base syntax doesn’t permit comma options in say phrases. (Maybe it should, but it doesn’t.)

The “with newlines” option you’re thinking of is described in manual chapter 11.14. It would be

  list the contents of the location, with newlines;

No brackets, no quote marks. That phrase can’t be interpolated into a string.

Also, it’s only built to handle the contents of some thing (or room). You can’t use it with a general description like “list all open doors, with newlines”.

To use it with a general description, you’d have to turn the description into an actual list-of-things, and then iterate through the list:

	let L be the list of open doors;
	repeat with T running through L:
		say "  [T][line break]";

Thanks Zarf. You’re always available to answer these kinds of questions, and it’s appreciated.

So, I should block the standard listing of objects, and use an iteration like your example to make my own listing instead, is the basic idea.

I did exactly that and it worked like a charm. Caught the process with a Rule for listing nondescript items and used that loop. Exactly what I needed to produce an ugly (for IF) but necessary (for a simulation of a computer) listing of “file” objects. A little playing around and I have file “sizes” spaced out like an ls command at a *nix prompt. Groovy, and thanks!

Love I7 to death but those little edge cases can drive one mad :slight_smile: