Me again, I'm starting to implement my conversation code and I'm having trouble with using script dictionaries which I haven't used before.
What I want to do is simplify the ask/tell system by condensing both into one command "talk to [character] about [topic]," which I have done by editing the commands. Ask and Tell no longer exist, but the new "talk to" command still calls the function "DoAskTell" so that I can use the ask tab to organise all the scripts for the different topics.
So the expression for the command is-
^talk to (?<object>.*) about (?<text>.*)$
Which runs the script-
DoAskTell (object, text, "ask", "askdefault", "DefaultAsk")
That all works fine.
In the interest of keeping things simple, I also want to include responses to the command "talk to (character)" used by itself without any topic. What I am trying to do, is include the topic key "default" so that typing "talk to (character)" is the same as typing "talk to (character) about default." The point of this is to keep the conversation responses in one place (the ask/tell tab) rather than adding a verb for every character.
Putting it together in one command I have-
^talk to (?<object>.*) about (?<text>.*)$|^talk to (?<object>.*)$
if (not IsDefined("text")) {
if (HasAttribute(object, "ask")) {
invoke (object.ask, default) -----> ?
do (object, "ask", default) ----> ?
}
else {
msg ("There's no point talking to inanimate objects.")
}
}
else {
DoAskTell (object, text, "ask", "askdefault", "DefaultAsk")
}
All of the code works fine except for the lines marked with ---->? (I included both to show what I'd tried). From reading the forum I got the impression that you need to use invoke rather than do for script dictionaries, but I can't get either to work and run the script I've set to the key "default."