adv3lite: Custom Listing

I haven’t been able to find a place in the adv3Lite docs where the usage and modification of Listers is described. Looking in english.t, I can see that the openingContentsLister is the one that I need to modify, but the code I’m looking at covers only showListPrefix, showListSuffix, showListEmpty, and something called showSubListing. The list itself is apparently being built elsewhere, so this code is less than completely explanatory.

In fact, all I need to do is modify the list prefix for one particular container – and I could easily do that if I understood how to attach a newly modified openingContentsLister to the container. But I have no clue how to do that. Would it be a property of the container? If so, what would the name of the property need to be, and what would I (or would I not) need to specify in the object to which the property points?

The list of objects is actually built in Thing.listSubcontentsOf(lister), where the lister parameter is the Lister to use. Unfortunately there’s no completely straightforward way to customize this (so this is something I’ll have to look at for the next update). You’re basically right that there should be a way to specify a custom lister, but at the moment the Lister to use is hard-coded in.

In the interim I suggest the following:

modify Thing
  dobjForOpen
  {
         action()
        {
            makeOpen(true);
            
            /* 
             *   If opening us is not being performed as an implicit action,
             *   list the contents that are revealed as a result of our being
             *   opened.
             */
            if(!gAction.isImplicit)
            {              
                unmention(contents);
                listSubcontentsOf(self, myOpeningContentsLister);
            }           
        }
  }

   myOpeningContentsLister = openingContentsLister
;

Then you can simply attach your custom lister to the myOpeningContentsLister property.

That makes perfect sense, Eric … except that I’ll have to dig deeper to figure out how to write my own lister. The listers in the library code don’t seem to list – they just add the prefix and suffix.

I expect I can puzzle it out.

Edit: Okay, got it. I had to do the same trick with the lookInLister, because here too I need to mention something that’s in the container but can’t be removed. It seems to be working, with the modifications to Thing that you suggested. Thanks!