To act-on (th - a thing) (for multiple objects)


I was trying to clean up some code/save keystrokes, and I developed the following stubs that also seem to save a bit of memory and keystrokes.

to moot (th - a thing): move th to solved-room

definition: a thing (called th) is moot:
  if th is in solved-room, yes;

This worked well until I got to

moot all carried not warpable things;


move all carried not warpable things to solved-room;

works fine, but I was wondering if there was a way I could use the “moot” syntax that makes coding easier for individual items. I had assumed that Inform would grok “moot (multiple things)” as successive calls to moot, but this was a bit too ambitious.

The error reads as follows:

In the line 'moot all held things' , I read 'held things' where I was expecting to find a (single) specific example of 'a thing'.

I also noticed this experiment code works, but it feels wrong. Am I just seeing ghosts? Is there a better way to do things?

a thing can be silly. A thing is usually not silly.

to blather (q - a list of things):
	say "[q]".
every turn:
	blather list of all silly things.

Lets me pass multiple things. But I don’t know if passing a list as a parameter has any possible odd negative effects. This feels like a basic question I should have known for a while, but I never tried anything like this, and I’m just wondering if I’m missing anything. Maybe it can help someone else, too.

I’m (still) on version 6G60.

(matt w) #2

I don’t see any reason why passing a list would create problems, though I guess I wouldn’t know if it did!

In 6M62 at least, you can also use a description as a parameter as discussed in §22.2 of Writing with Inform (6M62, so it’s probably §21.2 in 6G60):

To enumerate (collection - a description of objects): 
    repeat with the item running through the collection: 
        say "-- [The item]."

lets you do “enumerate lighted rooms.” So doing something like that should let you do “moot all carried not warpable things.” (You might need to keep the definition for individual things, I’m not sure. EDIT: §22.2 says that the description can be one thing like “The Corn Market” so I’d guess you wouldn’t need a separate case for one thing.)

1 Like

Thanks (again,) Matt! I’m not surprised the feature you mentioned was added–it’s not critical, but it’s obviously handy.

I’ve just gotten so used to the old version, and I don’t want to rebuild… Now that I’ve been using it since (oh dear) 2011, I sort of understand how I6 people have kept at it all these years. But it’s good to see Inform is growing .

I suppose if things break, I can always just use a regular expression search-and-replace in notepad++.

mootlist list of (.*); -> move all \1 to solved-room.

(matt w) #4

I think the feature I mentioned is in 6G60 too! The relevant section of the documentation looks the same–it’s just that the section is §21.2 rather than §22.2, because 6L and later versions have an extra documentation chapter about adaptive text and responses.

This thing seems to work in 6G60:

Lab is a room. The player is in Lab.

Solvedroom is a room.

The player carries a rock, a roll, a stone, a stein, and a kludge.

To moot (D - description of things):
	repeat with item running through D:
		move item to solvedroom. 
Instead of jumping: 
	moot all carried things.
1 Like