adv3Lite: Indistinguishables

The business of indistinguishable items is treated only briefly in the “Learning” document. The implication there (p. 281) seems to be that when there are five indistinguishable grapes in a bowl, the player will naturally type ‘take a grape’ rather than ‘take grapes’. Just now I’ve created three indistinguishable chairs. The output is very clumsy, and reveals at least one library bug.

Here’s the code:

[code]class PatioChair: Platform, Heavy, Fixture
vocab = ‘wrought-iron chair; uncomfortable black iron metal; seat curlicue filigree’
desc = "The black wrought-iron chairs are much alike — masses of metal curlicues and filigree. They look quite uncomfortable. "
canSitOnMe = true
// and because we want to allow ‘sit in chair’:
isEnterable = true
cannotTakeMsg = "You heft the nearest chair experimentally. Not surprisingly, it proves both
heavy and unwieldy. Having no particular need to burden yourself with such an object,
you put it back down. "

  • chair1: PatioChair;
  • chair2: PatioChair;
  • chair3: PatioChair;[/code]

And here’s the output:

Note the bug in the last bit (“getting offs”). Well, maybe there are two or three bugs, because you certainly weren’t on the first two chairs, and also, you’re not getting on all three of them.

My cursory examination of the Library Reference Manual suggested to me that the way to fix “The wrought-iron chair is not something you can enter” is by making isEnterable=true. That seems not to have worked at all. But the big question is how to suppress all of that extra output when the player types ‘chairs’ rather than ‘chair’.

Edit: The repetition of the cannotTakeMsg is my fault – I should have used a single-quoted string. But the rest of the output is as shown.

The easiest one to fix is the sit in/sit on problem.

You can’t sit in the chair because it appears that the default contType for Platform is On.

See the Adv3Lite manual, at file///…lib/adv3Lite/docs/manual/thing.htm#defining_containment

Set contType = In in order to get in the chair.

With contType = On, you can only get on, not in the chair. An object can have only one contType.

You can fix this with dobjFor(GetIn) asDobjFor(GetOn) (assuming you leave contType at its default.)

There is still a minor glitch—now when you sit in the chair, the game text will be You get on the chair.

But I’ve come to accept the mismatch of prepositions as an inconsequential hiccup. Maybe you will too. :slight_smile:


If it were my problem, I think I would just do an end run around it. Since it is highly unlikely that you would ever want the user to do something to all three chairs simultaneously, simply suppress any attempt to enter chairs on the command line. Force it a single chair.


StringPreParser doParsing(str,which) { if(str.find('chairs')) str = str.findReplace('chairs', 'chair'); return str; } ;


If you do want to allow chairs in the input, but just not here, not now, then you can get creative with if/else statements in the StringPreParser code.


Using preparsing is probably the best solution – thanks. I haven’t really gotten that far into the library yet. Just now I stumbled onto this related problem (which again, preparsing will probably fix). The player is carrying one purse – there is, in fact, only one purse in the game. But here’s the output:

That pretty much has to be a library bug.

It may take a bit of time for me to investigate this, but the thing that strikes me immediately is that the parser shouldn’t be accepting commands like SIT ON CHAIRS or PUT PURSE ON CHAIRS in the first place, since the VerbRules don’t allow (or aren’t meant to allow) multiple objects in those slots. If there is a bug in the parser that’s allowing this I’ll probably have to back to Mike Roberts for a solution, since adv3Lite basically uses his Mercury parser.

A little further investigation reveals that the parser is indeed ignoring grammar rules that are meant to restrict either the direct object or the indirect object to a single object. I’ve come up with a partial fix, but it doesn’t seem to work with plurals (such as SIT ON CHAIRS), so I’ll probably need to get back to Mike on this.

EDIT: I’ve emailed Mike and in the meantime come up with a pretty kludgy fix for stopping inappropriate plurals like SIT ON CHAIRS, which I’ve emailed to Jim to try.