NPCs ‐ Conversations ‐ Talk Discuss - ThePix/QuestJS GitHub Wiki
By default, this feature is turned off, as this allows Quest to tell the player that she is not going to get anywhere using TALK TO. To turn it on, go to the setting.js file, and add this:
settings.noTalkTo = false
The TALK/DISCUSS system is experimental. It will work fine in QuestJS, but I am not aware of any games that use it even in other systems, and just the fact that it is unknown may cause users to baulk. That said, it is very easy. The user types TALK TO KYLE to nominate Kyle as the target of conversations, and then types DISCUSS WEATHER to talk about the weather with him. Kyle will remain the target of conversations until he is in a different room to the player or until another target is nominated.
This is complimentary to ASK and TELL; you could have both systems in the same game. The player could ASK KYLE ABOUT THE WEATHER, or could TALK TO KYLE, and then DISCUSS THE WEATHER.
The first step is to give our NPC a talkto function. We can use a built in one, as long as we provide a message for it to use.
createItem("Kyle", NPC(false), {
loc:"lounge",
examine:"A grizzly bear. But cute.",
talkto:util.talkDiscuss,
talktoMsg:"You say 'Hello,' to Kyle, and he replies in kind.",
})
Then we need to provide some topics to discuss. This is exactly the same as for ASK/TELL, so this example uses the same "askOptions" as there. All the information on that page applies here - except there is no linking word (text2).
createItem("Kyle", NPC(false), {
loc:"lounge",
examine:"A grizzly bear. But cute.",
talkto:util.talkDiscuss,
talktoMsg:"You say 'Hello,' to Kyle, and he replies in kind.",
askOptions:[
{
test:function(p) { return p.text.match(/(house|home)/); },
msg:"'I like it,' says Kyle.",
},
{
test:function(p) { return p.text.match(/garden/) && w.garden.fixed; },
msg:"'Looks much better now,' Kyle says with a grin.",
},
{
test:function(p) { return p.text.match(/garden/) && w.Kyle.needsWorkCount === 0; },
msg:"'Needs some work,' Kyle says with a sign.",
script:function(p) { w.Kyle.needsWorkCount++; },
},
{
test:function(p) { return p.text.match(/garden/); },
msg:"'I'm giving up hope of it ever getting sorted,' Kyle says.",
},
{
msg:"Kyle has no interest in that.",
failed:true,
}
],
needsWorkCount:0,
})
The only slight hiccup is that the help files will need modifying. QuestJS, by default, will offer help based on the settings in your game, and it is not going to guess this one as it is too like the other options.