inherited fails, wrong num of args exception (adv3Lite)

When Harry gets out of bed, he needs to put some clothes on. There is a hoodie, some shoes, and some pants in the room. If the player says put on all or put on pants (or shoes or shirt), Harry ptus them on. But if the player says put on clothes the game text says there are no clothes there.

To correct this, I have added clothes and clothing to the vocab of the pants and have written a Doer for Wear (which is the root action of PutOn) so that I can redirect a put on clothes to doInstead(Wear, ‘all’).

If the player issues the command put on all or put on shirt | pants | shoes, I want normal action to proceed, so I have included inherited.

And it causes a wrong number of arguemnts runtime error.

If I comment out the Doer, everything works fine (except put on clothes).

But with the Doer, I get the exception on inherited.

How can I call inherited with the correct number of arguments?

Here’s the code isolated in a test-bed environment…

#charset "us-ascii"

#include <tads.h>
#include "advlite.h"

versionInfo: GameID
    IFID = '243748b1-5310-4916-8436-890e9ccc16fd'
    name = 'test'
    byline = 'by Jerry Ford'
    htmlByline = 'by <a href="mailto:jerry.o.ford@gmail.com">
                  Jerry Ford</a>'
    version = '1'
    authorEmail = 'Jerry Ford <jerry.o.ford@gmail.com>'
    desc = 'Testing wear all doer'
    htmlDesc = 'Testing wear all doer.'

;

gameMain: GameMainDef
    /* the initial player character is 'harry' */
    initialPlayerChar = harry
    paraBrksBtwnSubcontents = nil
    usePastTense = true
;

// harry, main character
harry: Actor 'Harry;;man self' @roomA
    "Harry. <.p>"
    globalParamName = 'harry'
    isHim = true
    isInitState = true
    person = 3   
    proper = true
   
;
roomA: Room 'Room A'
    "Now in Room A."
   
;
+ hoodie: Thing, Wearable 'hoodie; sweat shirt; hoody hoodie sweatshirt'
    "The shirt was a dirty longsleeved sweatshirt with a hood---a hoody. <.p>"
;
+ runningShoes: Thing, Wearable 'pair of running shoes;;shoes sneakers pair'
    "The shoes were dirty, warn---comfortable looking. <.p>"
;
+ cargoPants: Container, Wearable 'pair of cargo pants;;pants pair clothes
    clothing'
    "The baggy, beige cargo pants had two large, button-down pockets (both
    of which were missing their buttons), one on
    each thigh, left and right. <.p>";
    
;
// wear
modify Wear
    getAll(cmd, role)
    {
        // limit scope of "wear all" to just wearable objects (see also doff)
        return scopeList.subset({ x: x.isWearable});
    }
;

// wear
Doer 'wear Thing'
    execAction(c)
    {
        if(c.dobjNPs[1].tokens.length > 1)
        {
            if(c.dobjNPs[1].tokens[1] == 'clothes' ||
               c.dobjNPs[1].tokens[1] == 'clothing') 
                doInstead(Wear, 'all');
        }
        inherited;
    }
;

The normal rule is that inherited() should be called with the same arguments as the method that calls it, so in this case you need:

Doer 'wear Thing'
    execAction(c)
    {
        if(c.dobjNPs[1].tokens.length > 1)
        {
            if(c.dobjNPs[1].tokens[1] == 'clothes' ||
               c.dobjNPs[1].tokens[1] == 'clothing')
                doInstead(Wear, 'all');
        }
        inherited(c); // Pass c as a parameter to the inherited method
    }
;

That said, I doubt if this code will work as you expect, since ‘all’ isn’t a valid value to pass to doInstead() in this context. I think what you actually need to do is to add ‘clothes’ and ‘clothing’ as plural vocabulary to each item to which it might apply, for example:

+ shirt: Wearable 'shirt; white; clothes[pl] clothing[pl]'
   ...
;

The command WEAR CLOTHES/CLOTHING will then act on everything in scope for which clothes/clothing is thus defined as a plural.

Great, thanks, that works.