adv3Lite -- NPC, go east questions

I guess I am looking for confirmation, followed by some guidance. First the confirmation.

The following simple code results in the following transcript:[code]npc : Actor ‘npc’ @startroom
“An NPC.”
isHim = true
;

  • CommandTopic @Travel
    "I need you to <> I say.\b
    I’ll try, says the NPC. "
    allowAction = true
    ;

  • DefaultCommandTopic
    "The NPC ignores you. "
    ;

westRoom : Room ‘The west room’
"The west room. "
east = startroom
;[/code]

[code]The Starting Location
Add your description here.

The npc is here.

npc, go west
“I need you to go west” I say.

“I’ll try,” says the NPC.

[/code]
I’m looking for confirmation that the standard T3/adv3Lite combination doesn’t display any informational messages regarding the NPC leaving the room. (same things happen when he arrives.)

Assuming that is the case, what would be the most efficient way of adding a method to tweak the departing/arriving message?

Should I add the noteTraversal(traveler) method to each travelConnector or is it better practice to add beforeTravel(traveler, connector) and afterTravel(traveler, connector)to the Actor object?

Or is there a better approach? I know I can ultimately get the messaging working, but figured I would see if there was a better choice based on your collective experience.

Thanks,
– Mike

This is a bit strange. I get no output text even when I add my own message in a sayDeparting(conn) or sayActorDeparting(conn) to the npc. Reading the notes in the Library Reference Manual, it appears that either of those should be called as the npc moves.

I’m using adv3Lite 1.4. I’ll poke around a bit more.

I had initially tried the sayDeparting/sayActorDeparting methods but they didn’t work – I had assumed it was normal behavior since I traced the code and couldn’t find where it went off the rails.

Thanks for checking!

– Mike

The quick and dirty fix would be to use the noteTraversal(actor) method on the travelConnector to display an npc travel message.

The proper fix, which I’ll put in the library, is to amend the definition of the TravelAction class in action.t, in the doTravel() method at around line 1308 or so that it reads:

case TypeObject:     
            /* Note our connector */
            conn = loc.(direction.dirProp);
            
            /* 
             *   If the connector is visible to the actor then attempt travel
             *   via the connector.
             */
            if(conn.isConnectorVisible)
            {
                if(gActor == gPlayerChar)    // THESE ARE THE LINES TO CHANGE/ADD
                    conn.travelVia(gActor);
                else
                    gActor.travelVia(conn);
            }

This should have the effect of displaying all the standard travel messages you’d get normally.

Eric, I added this to action.t and it works perfectly.

Thanks again for the quick response!

– Mike

To amplify Eric’s response slightly, for smoother output I did this:

[code]npc : Actor ‘npc’ @startroom
"An NPC. "
isHim = true
sayActorDeparting(conn) {
"

The npc departs, heading for <<conn.name>>. ";
}
;

westRoom : Room ‘The west room’ ‘the room to the west’
"The west room. "
east = startroom
;[/code]
This produces the following transcript:

Thanks, Jim. I had implemented something similar in the actorState code – looks like we’re in sync.

– Mike