NPC response to commands that were carried out

so i’m aiming for this scenario:

>tim, sit down
"Sure thing!"
Tim sits on the chair.
>tim, sit down
Tim is already sitting on the chair.

so far i haven’t been able to suppress the "Sure thing!" response if the command doesn’t pass the verify or check stages.
i have a feeling that my latest attempt, using waitForIssuedCommand on gPlayerChar, would do the trick if i could figure out how to tell if an action (which in this case i’m retrieving with tim.mostRecentAction), was actually carried out.
before that i was playing around with doing this in obeyCommand, but that didn’t really lead anywhere.
any ideas?


so i’ve come to the conclusion that i’m going to have to modify every entry in npcActionMessages (and some others, for at least the posture changes), on top of having to put the response in every one of my custom actions. i’d really like not to have to do that though.

and now i believe that’s not a good way to go about it, because that wouldn’t restrict my custom message to just commands, would it?

it seems this would actually work, by checking gAction.issuer_ inside of e.g. the okayTakeMsg string. the only problem is that issuer_ is only set when i do nothing but obey the command. as soon as i have my own nestedActorAction, or newActorAction or such in the CommandTopic, the original issuer is lost.

Hey, I don’t think I have a total grasp on your situation, and I haven’t done any testing whatsoever…
Can you just do something like (very simplified)

modify Thing
   dobjFor(SitOn) { action() { if(gActor==Tim && gIssuingActor==me)
      "Sure thing. "; inherited; } }

nestedActorActions have a parentAction property that you could test for…
Sorry, I’m probably not being very helpful here, but I don’t have a good idea of where your code is at and what exactly you’re going for…

hey john,
that would sort of work, but i was hoping for not having to create / override dozens of methods just to get more or less the same NPC response each time.
the reason your approach only sort of works, is that when a command leads to an NPC carrying out more than one action, i’d also get the response above every action, instead of only once per given command
(e.g. instructing an NPC to wear a helmet he’s currently not carrying, triggering first a take, and then a wear action).
thanks for the tip with parentAction though. i didn’t think of that.

I think you could also suppress messages by putting them in a clause qualified by if(!gAction.isImplicit). But honestly, without knowing how many characters you’re working on, what commands/verbs you want responses for, how much those responses vary, when and when not to include or suppress default reports, and how often NPCs do autonomous actions versus carrying out PC commands, I still don’t have a good picture of how to best approach your situation… Hope you have success with your experimenting!

To be honest I have an NPC that’s going to be all over the game, and I will be having to figure stuff like you’re trying to figure out now, but I’m kind of saving that part till I have more of a game world for him to interact with… so it’s not my strongest suit yet…

so here’s what i’m aiming for:
i want every command to any NPC that is actually carried out (i.e. passes check() and verify()) to be able to output an aknowledgement in the form of something like <<one of>>Ok.<<or>>Sure.<<or>>Consider it done.<<at random>>
if the command triggers implicit actions, i still want only one acknowledgement of the command, and not once for every action taken.
so i don’t want this:

>tim, wear the helmet
Tim takes the helmet.
Tim puts on the helmet.

the thing is, i don’t want those two statements printed separately either, so i’ve given up on my intention of not messing with the transcript any time soon, and am now trying to accomplish both requirements there.
i’ll let you know if i’m successful :slight_smile:
thanks for your input so far!

Have you read the Tech Manual, chapters Manipulating the Transcript, and Implied Action Reports?
Also, there is a combine-action-reports extension available… I have it, but never tried using it yet. It may simplify your life, but I don’t know…

yeah, i’m going off of those examples. and i’d totally forgotten about that extension. thanks!

Wondering if you could also do something with the maybeAnnounceImplicit method of Action… again, all stuff I have yet to test for my own game…