T3: Lister options

As I poke away at the idea of a Fluids extension, I’m needing to construct and display a list of an arbitrary number of objects. (This is a side effect of the concepts in the extension: I want to have an Empty action, which needs a default for non-FluidContainer objects. The question naturally arises, what if the player tries to empty a basket? Answer: Stuff gets dumped on the floor. So we need to fly in a list of the stuff.)

So I create a local, temporary SimpleLister and pass the list of items being moved to its makeSimpleList method. Works like a charm … except that I’m getting the aName string, when I want the theName string:

I’m betting (or hoping) that I can fix this by overriding showListAll and giving it some value in the “options” argument. But I can’t find any documentation on this value. The comments in the source say only this: “‘options’ gives a set of ListXxx option flags.” Unfortunately, “ListXxx” is not to be found in the All Symbols page of the LRM, nor is it mentioned anywhere in the article on “Lists and Listers.” The latter article contains the word “options” only once, and it’s as an argument to showListItem … an argument whose possible values don’t seem to be mentioned. So I’m kinda stumped.

How can I get a SimpleLister to give me a comma-separated string of theNames, rather than aNames? If that’s not possible, what sort of Lister should I use, and are there any tricks to setting it up to produce a string?

I had exactly the same issue in my WIP. I dealt with it by overriding showListItem() on the SimpleLister thus:

/* 
 *   A variation of the object lister that uses definite rather than 
 *   indefinite articles to describe its members.
 */

objectDefLister: SimpleLister
    showListItem(obj, options, pov, infoTab)
    {
        say(obj.theName);
    }
;

– Eric

I once wrote an extension to make Listers simpler to use, including allowing different options for articles and letting you use them in message parameter substitutions ("{The/list yourList} {is} here."). At the time I used the same method as Eric - it was simple and didn’t seem to cause any problems. But when I looked at it again today I wondered if that might cause issues in certain complicated situations, since it omits some of the standard listing code, so I rewrote it to be a bit more respectful of the library code.

I never did much testing on it - either the original version or the new version I just whipped up - so I’m not sure it’s actually safe to use. And Eric’s code is probably quite adequate. But hey, if you’re interested, it’s attached to this post.
easyLister.zip (2.26 KB)

Thanks, Eric. That works.

Emily, I’ve downloaded your extension and I’ll take a look at it soon. It sounds very useful.