Trying to change the topic understood doesn't work

Trying to change the topic understood doesn’t work

I’m trying to find a way around it.

I’ve got a coding/syntax problem that I’d like some help with.

I’m trying to create a command to allow these type of commands:
say “Bob, where is the hammer.”

I’ve gotten as far as parsing ‘the topic understood’ which is ‘Bob, where is the hammer.’
I’d like to execute this type of saying by in the code trying this command:
ask Bob about hammer.

I’m using:
Include Conversation Package by Eric Eve.

I have two problems.

  1. First, I can’t get ‘say’ working because it is already defined, so I’ve substituted ‘xsay’. This a problem, but minor. If anyone can help me with that let me know.

  2. In the coding of xsay, I can set the current interlocutor, but I can’t redefine the topic understood so that the ‘try asking CH about it’ works.

understand “xsay [text]” as xsaying.
xsaying is an action applying to one topic.

Carry out xsaying:
let CH be Bob;
Change current interlocutor to CH;
[ none of the next steps works. ]
[ let TE be the text “piston”; ]
let TE be the printed name of TP;
[ change the topic understood to TE;]
Replace the topic understood with TE;
try asking CH about it;
[ try asking CH about “[TP]”;]

I get an error something like this:
*** Run-time problem P39: Attempt to say a snippet value which is currently invalid: words 2 to 13.

Thanks for your help.

DJM

I suppose you have to do this with regular expressions. This changes the player’s command in form SAY “X, WHERE IS Y” to ASK X ABOUT Y.

After reading a command: let N be indexed text; let N be the player's command; replace the regular expression "\bsay \'(.+?), where is (.+?)(\?*)\'" in N with "ask \1 about \2"; change the text of the player's command to N.

That being said, the usual convention is BOB, WHERE IS THE HAMMER (without SAY “…”) and experienced players might find it cumbersome to write the extra SAY and quotation marks.

Understand the command “say” as something new. See chapter 16.3 in the manual.

I’m not familiar with Eric’s extension so I can’t help you with the rest of the questions. Maybe someone else will cover that part.