how to trap walk command in adv3lite?

Harry is at Fisherman’s Wharf in San Francisco. There are a couple of historic museum ships tied up to the pier. I want to enter walk to (either of the two ships) and have the game window display appropriate text (“Harry walked out onto the pier and boarded the ship of choice…”).

Fisherman’s Wharf is defined as a Room, and the two ships are defined as Booth, Fixture objects.

I cannot figure out how to trap the walk command. No matter what I try, I always get this…

I want my text in place of the was right there boilerplate, and I want to magically transport Harry into the museum as a result of the walk command. Essentially, I want to implement the walk command the same way I implemented the board command (board streetcar puts Harry into a streetcar, which is also a Booth, Fixture object and for which I created a new verb Board).

I have tried dobjFor(Walk) with my substitute code in the action() method; I’ve tried remapping walk to enter, go and go to, I’ve tried creating new verbs Walk and WalkTo

VerbRule(WalkTo) 'walk to' multiDobj : VerbProduction action = WalkTo verPhrase = 'walk/walking' missingQ = 'walk where' ; DefineTAction(WalkTo) ;

…and I’ve tried using a Doer.

[code]Doer ‘walk to USS Pampanito | Jeremiah O’Brien’

strict = true
exec(curCmd)
{
    if(curCmd.dobj.name == 'USS Pampanito')
    {
        "Boo!";
    }
}

execAction(c)
{
    if(c.dobj.name == 'USS Pampanito')
    {
        "Boo!";
    }
}
where = [fishermansWharf]

;
[/code]

Nothing works. I am unable to figure out how to trap walk using breakpoints in the code. I’ve grepped the entire lite library for walk (a single hit, in a comment block in action.t or actions.t, forget exactly, but no matter, walk is not defined anywhere else that I can find.

Obviously, TADS knows about walk—see transcript excerpt above. But how can I intercept it?

Jerry

The command WALK TO X actually triggers the GoTo action.

The easiest way to trap the GoTo action to do what you want here is to make GoTo behave like Enter on the two Booths representing the ships, for example:

+ ship: Booth, Fixture 'ship'
    dobjFor(GoTo) asDobjFor(Enter)
;

The possible downside of this approach is that it will disable the normal function of the GoTo command, which is to enable the player character to navigate to a remote location or an object in a remote location, so you may instead prefer to use a Doer which only takes effect when the player character is in the same location as your ships, for example:

Doer 'go to Booth'
    execAction(c)
    {
        doInstead(Enter, c.dobj);
    }
    where = [fishermansWharf]
;

For future reference, the Action Reference chapter of the Library Manual can help you find the action corresponding to a verb like ‘walk’. Click on the W to get a list of commands whose first word begins with W and you’ll see ‘walk to somewhere’ listed followed by GoTo (the name of the action) hyperlinked; you can click on the hyperlink to get a bit more information about the GoTo action.

I think the reason your Doers didn’t quite work is that they need to use the programmatic object name of the objects involved, not the display name. So if you’d defined your ships as:

pampanito: Booth, Fixture 'USS Papanito;; ship'
;

jeremiah: Booth, Fixture 'Jeremiah O\'Brien;; ship'
;

Your Doer would need to have been something like:

Doer 'walk to pampanito|jeremiah'

    strict = true // but you probably don't need this
      
    execAction(c)
    {
        if(c.dobj.name == 'USS Pampanito')
        {
            "Boo!";
        }
    }
    where = [fishermansWharf]
;